diff --git "a/pgsql-performance.200507" "b/pgsql-performance.200507" new file mode 100644--- /dev/null +++ "b/pgsql-performance.200507" @@ -0,0 +1,53070 @@ +From pgsql-performance-owner@postgresql.org Fri Jul 1 05:57:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4AB2F529E7 + for ; + Fri, 1 Jul 2005 05:57:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42700-01 + for ; + Fri, 1 Jul 2005 08:57:06 +0000 (GMT) +Received: from zigo.dhs.org (ua-83-227-204-174.cust.bredbandsbolaget.se + [83.227.204.174]) + by svr1.postgresql.org (Postfix) with ESMTP id 8C9FD529DA + for ; + Fri, 1 Jul 2005 05:57:03 -0300 (ADT) +Received: from zigo.zigo.dhs.org (zigo.zigo.dhs.org [192.168.0.1]) + by zigo.dhs.org (Postfix) with ESMTP + id A923C8467; Fri, 1 Jul 2005 10:57:02 +0200 (CEST) +Date: Fri, 1 Jul 2005 10:57:02 +0200 (CEST) +From: Dennis Bjorklund +To: John Mendenhall +Cc: pgsql-performance@postgresql.org +Subject: Re: ported application having performance issues +In-Reply-To: <20050630235821.GA2163@calvin.surfutopia.net> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=ISO-8859-1 +Content-Transfer-Encoding: 8BIT +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.331 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/1 +X-Sequence-Number: 13242 + +On Thu, 30 Jun 2005, John Mendenhall wrote: + +> Our setting for effective_cache_size is 2048. +> +> random_page_cost = 4, effective_cache_size = 2048 time approximately 4500ms +> random_page_cost = 3, effective_cache_size = 2048 time approximately 1050ms +> random_page_cost = 3, effective_cache_size = 4096 time approximately 1025ms +> +> The decrease of random_page_cost to 3 caused the plan +> to work properly, using the lead_requests table as a +> join starting point and using the contacts index. + +The effective_cache_size still looks small. As a rule of tumb you might +want effective_cache_size to be something like 1/2 or 2/3 of your total +memory. I don't know how much you had, but effective_cache_size = 4096 is +only 32M. + +shared_buffers and effective_cache_size is normally the two most important +settings in my experience. + +-- +/Dennis Bj�rklund + + +From pgsql-performance-owner@postgresql.org Fri Jul 1 10:33:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7BC9D52A42 + for ; + Fri, 1 Jul 2005 10:33:21 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03201-06 + for ; + Fri, 1 Jul 2005 13:33:10 +0000 (GMT) +Received: from outmail.freedom2surf.net (outmail1.freedom2surf.net + [194.106.33.237]) + by svr1.postgresql.org (Postfix) with ESMTP id EE76B529A6 + for ; + Fri, 1 Jul 2005 10:33:06 -0300 (ADT) +Received: from sam.lan.samason.me.uk (sam.samason.me.uk [83.67.41.231]) + by outmail.freedom2surf.net (8.12.10/8.12.10) with ESMTP id + j61DX9ch017854 + for ; Fri, 1 Jul 2005 14:33:09 +0100 +Received: by sam.lan.samason.me.uk (Postfix, from userid 1000) + id 4827F63745; Fri, 1 Jul 2005 14:33:05 +0100 (BST) +Date: Fri, 1 Jul 2005 14:33:05 +0100 +From: Sam Mason +To: pgsql-performance@postgresql.org +Subject: planner picking more expensive plan +Message-ID: <20050701133305.GB2623@sam.lan.samason.me.uk> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.5.8i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/2 +X-Sequence-Number: 13243 + +Hi, + +I've just been referred here after a conversion on IRC and everybody +seemed to think I've stumbled upon some strangeness. + +The planner (in PG version 8.0.2) is choosing what it thinks is a more +expensive plan. I've got a table of animals (about 3M rows) and their +movements (about 16M rows), and I'm trying to execute this query: + + SELECT a.birthlocnid, m.locnid + FROM animals a + LEFT JOIN movements m ON (a.animalid = m.animalid AND m.mtypeid=0) + LIMIT 10; + +If I have "work_mem" set to something small (1000) it uses this plan: + + QUERY PLAN + + Limit (cost=0.00..202.52 rows=10 width=8) (actual time=0.221..0.600 rows=10 loops=1) + -> Merge Left Join (cost=0.00..66888828.30 rows=3302780 width=8) (actual time=0.211..0.576 rows=10 loops=1) + Merge Cond: ("outer".animalid = "inner".animalid) + -> Index Scan using animals_pkey on animals a (cost=0.00..10198983.91 rows=3302780 width=8) (actual time=0.112..0.276 rows=10 loops=1) + -> Index Scan using movement_animal on movements m (cost=0.00..56642740.73 rows=3107737 width=8) (actual time=0.088..0.235 rows=10 loops=1) + Filter: (mtypeid = 0) + Total runtime: 0.413 ms + +But if I increase "work_mem" to 10000 it uses this plan: + + QUERY PLAN + + Limit (cost=565969.42..566141.09 rows=10 width=8) (actual time=27769.047..27769.246 rows=10 loops=1) + -> Merge Right Join (cost=565969.42..57264070.77 rows=3302780 width=8) (actual time=27769.043..27769.228 rows=10 loops=1) + Merge Cond: ("outer".animalid = "inner".animalid) + -> Index Scan using movement_animal on movements m (cost=0.00..56642740.73 rows=3107737 width=8) (actual time=0.022..0.154 rows=10 loops=1) + Filter: (mtypeid = 0) + -> Sort (cost=565969.42..574226.37 rows=3302780 width=8) (actual time=27768.991..27769.001 rows=10 loops=1) + Sort Key: a.animalid + -> Seq Scan on animals a (cost=0.00..77086.80 rows=3302780 width=8) (actual time=0.039..5620.651 rows=3303418 loops=1) + Total runtime: 27851.097 ms + + +I've tried playing with the statistics as people suggested on IRC but to +no effect. There was some discussion about why it would be doing this, +but nothing obvious came out of it. + +SHOW ALL output is at the end of this mail but it should be pretty +standard apart from: + + shared_buffers = 10000 + work_mem = 8192 + max_connections = 100 + effective_cache_size = 10000 + +Hope that's enough information to be useful. + +Thanks. + + Sam + + + name | setting +--------------------------------+-------------------------------- + add_missing_from | on + archive_command | /home/postgres/pgarchive "%p" + australian_timezones | off + authentication_timeout | 60 + bgwriter_delay | 200 + bgwriter_maxpages | 100 + bgwriter_percent | 1 + block_size | 8192 + check_function_bodies | on + checkpoint_segments | 3 + checkpoint_timeout | 300 + checkpoint_warning | 30 + client_encoding | SQL_ASCII + client_min_messages | notice + commit_delay | 0 + commit_siblings | 5 + config_file | /home/pgdata/postgresql.conf + cpu_index_tuple_cost | 0.001 + cpu_operator_cost | 0.0025 + cpu_tuple_cost | 0.01 + custom_variable_classes | unset + data_directory | /home/pgdata + DateStyle | ISO, MDY + db_user_namespace | off + deadlock_timeout | 1000 + debug_pretty_print | off + debug_print_parse | off + debug_print_plan | off + debug_print_rewritten | off + debug_shared_buffers | 0 + default_statistics_target | 10 + default_tablespace | unset + default_transaction_isolation | read committed + default_transaction_read_only | off + default_with_oids | on + dynamic_library_path | $libdir + effective_cache_size | 10000 + enable_hashagg | on + enable_hashjoin | on + enable_indexscan | on + enable_mergejoin | on + enable_nestloop | on + enable_seqscan | off + enable_sort | on + enable_tidscan | on + explain_pretty_print | on + external_pid_file | unset + extra_float_digits | 0 + from_collapse_limit | 8 + fsync | on + geqo | on + geqo_effort | 5 + geqo_generations | 0 + geqo_pool_size | 0 + geqo_selection_bias | 2 + geqo_threshold | 12 + hba_file | /home/pgdata/pg_hba.conf + ident_file | /home/pgdata/pg_ident.conf + integer_datetimes | off + join_collapse_limit | 8 + krb_server_keyfile | unset + lc_collate | C + lc_ctype | C + lc_messages | C + lc_monetary | C + lc_numeric | C + lc_time | C + listen_addresses | * + log_connections | on + log_destination | stderr + log_directory | pg_log + log_disconnections | off + log_duration | off + log_error_verbosity | default + log_executor_stats | off + log_filename | postgresql-%Y-%m-%d_%H%M%S.log + log_hostname | off + log_line_prefix | %t %u + log_min_duration_statement | -1 + log_min_error_statement | panic + log_min_messages | notice + log_parser_stats | off + log_planner_stats | off + log_rotation_age | 1440 + log_rotation_size | 10240 + log_statement | all + log_statement_stats | off + log_truncate_on_rotation | off + maintenance_work_mem | 256000 + max_connections | 100 + max_files_per_process | 1000 + max_fsm_pages | 20000 + max_fsm_relations | 1000 + max_function_args | 32 + max_identifier_length | 63 + max_index_keys | 32 + max_locks_per_transaction | 64 + max_stack_depth | 2048 + password_encryption | on + port | 5432 + pre_auth_delay | 0 + preload_libraries | unset + random_page_cost | 4 + redirect_stderr | off + regex_flavor | advanced + rendezvous_name | unset + search_path | $user,public + server_encoding | SQL_ASCII + server_version | 8.0.2 + shared_buffers | 1000 + silent_mode | off + sql_inheritance | on + ssl | off + statement_timeout | 0 + stats_block_level | off + stats_command_string | off + stats_reset_on_server_start | on + stats_row_level | off + stats_start_collector | on + superuser_reserved_connections | 2 + syslog_facility | LOCAL0 + syslog_ident | postgres + TimeZone | GMT + trace_notify | off + transaction_isolation | read committed + transaction_read_only | off + transform_null_equals | off + unix_socket_directory | unset + unix_socket_group | unset + unix_socket_permissions | 511 + vacuum_cost_delay | 0 + vacuum_cost_limit | 200 + vacuum_cost_page_dirty | 20 + vacuum_cost_page_hit | 1 + vacuum_cost_page_miss | 10 + wal_buffers | 8 + wal_sync_method | fdatasync + work_mem | 128000 + zero_damaged_pages | off + + +From pgsql-performance-owner@postgresql.org Fri Jul 1 11:23:00 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A5BCD5287E + for ; + Fri, 1 Jul 2005 11:22:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13951-02 + for ; + Fri, 1 Jul 2005 14:22:48 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CC1A0529A6 + for ; + Fri, 1 Jul 2005 11:22:45 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j61EMoua028889; + Fri, 1 Jul 2005 10:22:50 -0400 (EDT) +To: Sam Mason +Cc: pgsql-performance@postgresql.org +Subject: Re: planner picking more expensive plan +In-reply-to: <20050701133305.GB2623@sam.lan.samason.me.uk> +References: <20050701133305.GB2623@sam.lan.samason.me.uk> +Comments: In-reply-to Sam Mason + message dated "Fri, 01 Jul 2005 14:33:05 +0100" +Date: Fri, 01 Jul 2005 10:22:50 -0400 +Message-ID: <28888.1120227770@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/3 +X-Sequence-Number: 13244 + +Sam Mason writes: +> The planner (in PG version 8.0.2) is choosing what it thinks is a more +> expensive plan. + +I fooled around trying to duplicate this behavior, without success. +Can you create a self-contained test case? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jul 1 11:58:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0EE5552952 + for ; + Fri, 1 Jul 2005 11:58:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23235-03 + for ; + Fri, 1 Jul 2005 14:58:45 +0000 (GMT) +Received: from colo.samason.me.uk (unknown [69.55.228.22]) + by svr1.postgresql.org (Postfix) with ESMTP id 172855292D + for ; + Fri, 1 Jul 2005 11:58:44 -0300 (ADT) +Received: from colo.samason.me.uk (colo [69.55.228.22]) + by colo.samason.me.uk (8.12.11/8.12.11) with ESMTP id j61Ewn2L051935 + for ; + Fri, 1 Jul 2005 15:58:49 +0100 (BST) + (envelope-from sam@colo.samason.me.uk) +Received: (from sam@localhost) + by colo.samason.me.uk (8.12.11/8.12.11/Submit) id j61EwnaS051895 + for pgsql-performance@postgresql.org; + Fri, 1 Jul 2005 15:58:49 +0100 (BST) (envelope-from sam) +Date: Fri, 1 Jul 2005 15:58:48 +0100 +From: Sam Mason +To: pgsql-performance@postgresql.org +Subject: Re: planner picking more expensive plan +Message-ID: <20050701145848.GW62747@colo.samason.me.uk> +Mail-Followup-To: Sam Mason , + pgsql-performance@postgresql.org +References: <20050701133305.GB2623@sam.lan.samason.me.uk> + <28888.1120227770@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <28888.1120227770@sss.pgh.pa.us> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/4 +X-Sequence-Number: 13245 + +Tom Lane wrote: +>I fooled around trying to duplicate this behavior, without success. +>Can you create a self-contained test case? + +I'll try and see if I can put something together, it's probably +going to be early next week though. I wont be able to give you our +data, so I'll be a bit of a headscratching exercise generating +something that'll provoke the same behaviour. + +Not sure if it'll help, but here's what the database schema looks +like at the moment: + + Table "public.animals" + Column | Type | Modifiers +-------------+-----------------------+----------- + animalid | integer | not null + sex | character(1) | not null + dob | date | not null + birthlocnid | integer | + breedid | character varying(8) | + eartag_1 | character varying(20) | + eartag_2 | character varying(20) | + eartag_3 | character varying(20) | +Indexes: + "animals_pkey" primary key, btree (animalid) + "animal_birthlocn" btree (birthlocnid) + "animal_breed" btree (breedid) + "animal_eartag" btree (eartag_1) +Check constraints: + "animal_sex" CHECK (sex = 'M'::bpchar OR sex = 'F'::bpchar) + + Table "public.movements" + Column | Type | Modifiers +----------+---------+----------- + locnid | integer | not null + animalid | integer | not null + movedate | date | not null + mtypeid | integer | not null +Indexes: + "movement_animal" btree (animalid) + "movement_location" btree (locnid) + "movement_movedate" btree (movedate) + "movement_movetype" btree (mtypeid) +Foreign-key constraints: + "movement_location" FOREIGN KEY (locnid) REFERENCES locations(locnid) + "movement_animal" FOREIGN KEY (animalid) REFERENCES animals(animalid) + "movement_type" FOREIGN KEY (mtypeid) REFERENCES k_movement_type(mtypeid) + + Table "public.locations" + Column | Type | Modifiers +--------+-----------------------+----------- + locnid | integer | not null + ptype | character varying(8) | + ltype | character varying(8) | not null + cph | character varying(20) | + unk | integer | +Indexes: + "locations_pkey" primary key, btree (locnid) + "location_cph" btree (cph) + "location_ltype" btree (ltype) + "location_ptype" btree (ptype) +Foreign-key constraints: + "location_ptype" FOREIGN KEY (ptype) REFERENCES k_premise_type(ptypeid) + "location_ltype" FOREIGN KEY (ltype) REFERENCES k_location_type(ltypeid) + +As I said, animals contains about 3M rows, movements about 16M rows +and locations about 80K rows. There are about 3 to 8 rows for each +and every animal in the movements table, with at most one entry of +mtypeid=0 for each animal (95% of the animals have an entry). + +Not sure if that's going to help making some demo data. It's just +that it took quite a while loading it all here, so coming up with +some code to make demo data may take a while. + + +Thanks! + + Sam + +From pgsql-performance-owner@postgresql.org Fri Jul 1 12:18:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6931F5292D + for ; + Fri, 1 Jul 2005 12:18:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27596-01 + for ; + Fri, 1 Jul 2005 15:18:17 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id 3AB295287E + for ; + Fri, 1 Jul 2005 12:18:15 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050701151814m92008hu1ne>; Fri, 1 Jul 2005 15:18:14 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id ED170560B3; Fri, 1 Jul 2005 10:18:12 -0500 (CDT) +Received: from [192.168.1.11] (liliana.arbash-meinel.com [192.168.1.11]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 9BD4655FF5; + Fri, 1 Jul 2005 10:17:54 -0500 (CDT) +Message-ID: <42C55EA0.1000404@arbash-meinel.com> +Date: Fri, 01 Jul 2005 10:17:52 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Sam Mason +Cc: pgsql-performance@postgresql.org +Subject: Re: planner picking more expensive plan +References: <20050701133305.GB2623@sam.lan.samason.me.uk> +In-Reply-To: <20050701133305.GB2623@sam.lan.samason.me.uk> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig57E9EE20779CE456D1DF6438" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/5 +X-Sequence-Number: 13246 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig57E9EE20779CE456D1DF6438 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Sam Mason wrote: + +>Hi, +> +>I've just been referred here after a conversion on IRC and everybody +>seemed to think I've stumbled upon some strangeness. +> +>The planner (in PG version 8.0.2) is choosing what it thinks is a more +>expensive plan. I've got a table of animals (about 3M rows) and their +>movements (about 16M rows), and I'm trying to execute this query: +> +> SELECT a.birthlocnid, m.locnid +> FROM animals a +> LEFT JOIN movements m ON (a.animalid = m.animalid AND m.mtypeid=0) +> LIMIT 10; +> +> +> +Why are you using LIMIT without having an ORDER BY? +What are actually trying to get out of this query? Is it just trying to +determine where the 'home' locations are? +It just seems like this query isn't very useful. As it doesn't restrict +by animal id, and it just gets 10 randomly selected animals where +m.mtypeid=0. +And why a LEFT JOIN instead of a normal join? +Anyway, the general constraints you are applying seem kind of confusing. +What happens if you change the plan to: + + SELECT a.birthlocnid, m.locnid + FROM animals a + LEFT JOIN movements m ON (a.animalid = m.animalid AND m.mtypeid=0) + ORDER BY a.animalid LIMIT 10; + + +I would guess that this would help the planner realize it should try to +use an index, since it can realize that it wants only a few rows by +a.animalid in order. +Though I also recognize that you aren't returning a.animalid so you +don't really know which animals you are returning. + +I get the feeling you are trying to ask something like "do animals stay +at their birth location", or at least "how are animals moving around". I +don't know what m.typeid = 0 means, but I'm guessing it is something +like where their home is. + +Anyway, I would say you need to put a little bit more restriction in, so +the planner can figure out how to get only 10 rows. + +John +=:-> + +>If I have "work_mem" set to something small (1000) it uses this plan: +> +> QUERY PLAN +> +> Limit (cost=0.00..202.52 rows=10 width=8) (actual time=0.221..0.600 rows=10 loops=1) +> -> Merge Left Join (cost=0.00..66888828.30 rows=3302780 width=8) (actual time=0.211..0.576 rows=10 loops=1) +> Merge Cond: ("outer".animalid = "inner".animalid) +> -> Index Scan using animals_pkey on animals a (cost=0.00..10198983.91 rows=3302780 width=8) (actual time=0.112..0.276 rows=10 loops=1) +> -> Index Scan using movement_animal on movements m (cost=0.00..56642740.73 rows=3107737 width=8) (actual time=0.088..0.235 rows=10 loops=1) +> Filter: (mtypeid = 0) +> Total runtime: 0.413 ms +> +>But if I increase "work_mem" to 10000 it uses this plan: +> +> QUERY PLAN +> +> Limit (cost=565969.42..566141.09 rows=10 width=8) (actual time=27769.047..27769.246 rows=10 loops=1) +> -> Merge Right Join (cost=565969.42..57264070.77 rows=3302780 width=8) (actual time=27769.043..27769.228 rows=10 loops=1) +> Merge Cond: ("outer".animalid = "inner".animalid) +> -> Index Scan using movement_animal on movements m (cost=0.00..56642740.73 rows=3107737 width=8) (actual time=0.022..0.154 rows=10 loops=1) +> Filter: (mtypeid = 0) +> -> Sort (cost=565969.42..574226.37 rows=3302780 width=8) (actual time=27768.991..27769.001 rows=10 loops=1) +> Sort Key: a.animalid +> -> Seq Scan on animals a (cost=0.00..77086.80 rows=3302780 width=8) (actual time=0.039..5620.651 rows=3303418 loops=1) +> Total runtime: 27851.097 ms +> +> +>I've tried playing with the statistics as people suggested on IRC but to +>no effect. There was some discussion about why it would be doing this, +>but nothing obvious came out of it. +> +>SHOW ALL output is at the end of this mail but it should be pretty +>standard apart from: +> +> shared_buffers = 10000 +> work_mem = 8192 +> max_connections = 100 +> effective_cache_size = 10000 +> +>Hope that's enough information to be useful. +> +>Thanks. +> +> Sam +> + + +--------------enig57E9EE20779CE456D1DF6438 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCxV6iJdeBCYSNAAMRAme8AJwKdr9g+MxhH4aCrz95aKrrBr66fgCfboU2 +0T3tjYDEPciwHkTLwJBmA8Q= +=lbpU +-----END PGP SIGNATURE----- + +--------------enig57E9EE20779CE456D1DF6438-- + +From pgsql-performance-owner@postgresql.org Fri Jul 1 12:58:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 802475297E + for ; + Fri, 1 Jul 2005 12:58:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 35693-03 + for ; + Fri, 1 Jul 2005 15:58:35 +0000 (GMT) +Received: from colo.samason.me.uk (unknown [69.55.228.22]) + by svr1.postgresql.org (Postfix) with ESMTP id 87C15529F3 + for ; + Fri, 1 Jul 2005 12:58:30 -0300 (ADT) +Received: from colo.samason.me.uk (colo [69.55.228.22]) + by colo.samason.me.uk (8.12.11/8.12.11) with ESMTP id j61FwUj5099838 + for ; + Fri, 1 Jul 2005 16:58:30 +0100 (BST) + (envelope-from sam@colo.samason.me.uk) +Received: (from sam@localhost) + by colo.samason.me.uk (8.12.11/8.12.11/Submit) id j61FwUik099832 + for pgsql-performance@postgresql.org; + Fri, 1 Jul 2005 16:58:30 +0100 (BST) (envelope-from sam) +Date: Fri, 1 Jul 2005 16:58:30 +0100 +From: Sam Mason +To: pgsql-performance@postgresql.org +Subject: Re: planner picking more expensive plan +Message-ID: <20050701155829.GX62747@colo.samason.me.uk> +Mail-Followup-To: Sam Mason , + pgsql-performance@postgresql.org +References: <20050701133305.GB2623@sam.lan.samason.me.uk> + <42C55EA0.1000404@arbash-meinel.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42C55EA0.1000404@arbash-meinel.com> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/6 +X-Sequence-Number: 13247 + +John A Meinel wrote: +>Why are you using LIMIT without having an ORDER BY? + +I'm just exploring the data, trying to figure out what it's like. + +>It just seems like this query isn't very useful. As it doesn't restrict +>by animal id, and it just gets 10 randomly selected animals where +>m.mtypeid=0. + +Yup, that's the point. Check to see if the animals were born where +they say they were. The data's come from an external source and +I'm just trying to figure out how good it is before I do too much +with it + +>And why a LEFT JOIN instead of a normal join? + +I'm not sure if some animals will have missing data! + +>Anyway, the general constraints you are applying seem kind of confusing. + +This was a slightly cut down query in an attempt to reduce general +confusion -- I guess I failed. Sorry! + +>I would guess that this would help the planner realize it should try to +>use an index, since it can realize that it wants only a few rows by +>a.animalid in order. + +This seems to work the appropiate magic. It always seems to prefer +index scans now. + +The real point of asking this question orignally was to find out +why the planner was choosing a more expensive plan over a cheaper +one. When I discovered this orignally I was disabling seqscan and +then it picked the correct version. The actual work_mem didn't +change when I did this, it just picked the correct plan. I discovered +the work_mem parameter fiddle later. I think I forgot to mention +that in the original email though! + + + Sam + +From pgsql-performance-owner@postgresql.org Fri Jul 1 21:52:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 91E8B52801 + for ; + Fri, 1 Jul 2005 21:52:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44621-05 + for ; + Sat, 2 Jul 2005 00:52:37 +0000 (GMT) +Received: from calvin.surfutopia.net (calvin.surfutopia.net [67.120.245.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 3143452812 + for ; + Fri, 1 Jul 2005 21:52:36 -0300 (ADT) +Received: by calvin.surfutopia.net (Postfix, from userid 1000) + id 9D8DCF24B; Fri, 1 Jul 2005 17:52:37 -0700 (PDT) +Date: Fri, 1 Jul 2005 17:52:37 -0700 +From: John Mendenhall +To: Dennis Bjorklund +Cc: pgsql-performance@postgresql.org +Subject: Re: ported application having performance issues +Message-ID: <20050702005237.GA26087@calvin.surfutopia.net> +References: <20050630235821.GA2163@calvin.surfutopia.net> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/7 +X-Sequence-Number: 13248 + +Dennis, + +On Fri, 01 Jul 2005, Dennis Bjorklund wrote: + +> On Thu, 30 Jun 2005, John Mendenhall wrote: +> +> > Our setting for effective_cache_size is 2048. +> > +> > random_page_cost = 4, effective_cache_size = 2048 time approximately 4500ms +> > random_page_cost = 3, effective_cache_size = 2048 time approximately 1050ms +> > random_page_cost = 3, effective_cache_size = 4096 time approximately 1025ms +> +> The effective_cache_size still looks small. As a rule of tumb you might +> want effective_cache_size to be something like 1/2 or 2/3 of your total +> memory. I don't know how much you had, but effective_cache_size = 4096 is +> only 32M. +> +> shared_buffers and effective_cache_size is normally the two most important +> settings in my experience. + +I have increased the effective_cache_size to 16384 (128M). I have kept +random_page_cost at 3 for now. This appears to give me the performance +I need at this time. + +In the future, we'll look at other methods of increasing the +performance. + +Thank you all for all your suggestions. + +JohnM + +-- +John Mendenhall +john@surfutopia.net +surf utopia +internet services + +From pgsql-performance-owner@postgresql.org Fri Jul 1 22:59:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9018352968 + for ; + Fri, 1 Jul 2005 22:59:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53668-08 + for ; + Sat, 2 Jul 2005 01:59:42 +0000 (GMT) +Received: from mail.baymountain.com (mail.baymountain.com [8.7.96.19]) + by svr1.postgresql.org (Postfix) with SMTP id 8274C528C1 + for ; + Fri, 1 Jul 2005 22:59:40 -0300 (ADT) +Received: (qmail 2314 invoked by uid 504); 2 Jul 2005 01:59:43 -0000 +Received: from emil@baymountain.com by mail.baymountain.com by uid 501 with + qmail-scanner-1.16 (spamassassin: 2.53. Clear:SA:0(0.0/7.0):. + Processed in 0.246783 secs); 02 Jul 2005 01:59:43 -0000 +Received: from unknown (HELO briggspack.com) + (emil@briggspack.com@24.211.148.77) + by mail.baymountain.com with SMTP; 2 Jul 2005 01:59:43 -0000 +From: Emil Briggs +Reply-To: emil@baymountain.com +Organization: Baymountain, Inc. +To: pgsql-performance@postgresql.org +Subject: Planner constants for RAM resident databases +Date: Fri, 1 Jul 2005 21:59:38 -0400 +User-Agent: KMail/1.7.1 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200507012159.39041.emil@baymountain.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/8 +X-Sequence-Number: 13249 + + +I'm working with an application where the database is entirely resident in RAM +(the server is a quad opteron with 16GBytes of memory). It's a web +application and handles a high volume of queries. The planner seems to be +generating poor plans for some of our queries which I can fix by raising +cpu_tuple_cost. I have seen some other comments in the archives saying that +this is a bad idea but is that necessarily the case when the database is +entirely resident in RAM? + +Emil + +From pgsql-performance-owner@postgresql.org Fri Jul 1 23:08:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9B8D152800 + for ; + Fri, 1 Jul 2005 23:08:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59482-03 + for ; + Sat, 2 Jul 2005 02:08:28 +0000 (GMT) +Received: from gp.word-to-the-wise.com (gp.word-to-the-wise.com + [64.71.176.18]) + by svr1.postgresql.org (Postfix) with ESMTP id 595D952801 + for ; + Fri, 1 Jul 2005 23:08:25 -0300 (ADT) +Received: by gp.word-to-the-wise.com (Postfix, from userid 500) + id 34B778FC08E; Fri, 1 Jul 2005 19:08:23 -0700 (PDT) +Date: Fri, 1 Jul 2005 19:08:23 -0700 +From: Steve Atkins +To: pgsql-performance@postgresql.org +Subject: Re: Planner constants for RAM resident databases +Message-ID: <20050702020823.GA32264@gp.word-to-the-wise.com> +References: <200507012159.39041.emil@baymountain.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200507012159.39041.emil@baymountain.com> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.84 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_POST +X-Spam-Level: +X-Archive-Number: 200507/9 +X-Sequence-Number: 13250 + +On Fri, Jul 01, 2005 at 09:59:38PM -0400, Emil Briggs wrote: + +> I'm working with an application where the database is entirely resident in RAM +> (the server is a quad opteron with 16GBytes of memory). It's a web +> application and handles a high volume of queries. The planner seems to be +> generating poor plans for some of our queries which I can fix by raising +> cpu_tuple_cost. I have seen some other comments in the archives saying that +> this is a bad idea but is that necessarily the case when the database is +> entirely resident in RAM? + +If I'm understanding correctly that'll mostly increase the estimated +cost of handling a row relative to a sequential page fetch, which +sure sounds like it'll push plans in the right direction, but it +doesn't sound like the right knob to twiddle. + +What do you have random_page_cost set to? + +Cheers, + Steve + +From pgsql-performance-owner@postgresql.org Fri Jul 1 23:41:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6D47252812 + for ; + Fri, 1 Jul 2005 23:40:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65548-03 + for ; + Sat, 2 Jul 2005 02:40:50 +0000 (GMT) +Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) + by svr1.postgresql.org (Postfix) with ESMTP id 59F3D52801 + for ; + Fri, 1 Jul 2005 23:40:49 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP + id <20050702024053m9100ngas9e>; Sat, 2 Jul 2005 02:40:53 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id F0097560B3; Fri, 1 Jul 2005 21:40:52 -0500 (CDT) +Received: from [192.168.1.11] (liliana.arbash-meinel.com [192.168.1.11]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 9A77C56070; + Fri, 1 Jul 2005 21:40:49 -0500 (CDT) +Message-ID: <42C5FEB1.6090601@arbash-meinel.com> +Date: Fri, 01 Jul 2005 21:40:49 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: emil@baymountain.com +Cc: pgsql-performance@postgresql.org +Subject: Re: Planner constants for RAM resident databases +References: <200507012159.39041.emil@baymountain.com> +In-Reply-To: <200507012159.39041.emil@baymountain.com> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig870DC8A41B021865FE229B70" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/10 +X-Sequence-Number: 13251 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig870DC8A41B021865FE229B70 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Emil Briggs wrote: + +>I'm working with an application where the database is entirely resident in RAM +>(the server is a quad opteron with 16GBytes of memory). It's a web +>application and handles a high volume of queries. The planner seems to be +>generating poor plans for some of our queries which I can fix by raising +>cpu_tuple_cost. I have seen some other comments in the archives saying that +>this is a bad idea but is that necessarily the case when the database is +>entirely resident in RAM? +> +>Emil +> +> +> + +Generally, the key knob to twiddle when everything fits in RAM is +random_page_cost. If you truly have everything in RAM you could set it +almost to 1. 1 means that it costs exactly the same to go randomly +through the data then it does to go sequential. I would guess that even +in RAM it is faster to go sequential (since you still have to page and +deal with L1/L2/L3 cache, etc). But the default random_page_cost of 4 is +probably too high for you. + +John +=:-> + + +--------------enig870DC8A41B021865FE229B70 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCxf6xJdeBCYSNAAMRArOgAKCo02YFzzjRTAOqW113BryLR2l59QCdEb10 +WwGMl/V15c6lANMuXPQkN1U= +=nHp/ +-----END PGP SIGNATURE----- + +--------------enig870DC8A41B021865FE229B70-- + +From pgsql-performance-owner@postgresql.org Sat Jul 2 00:15:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A5E3752896 + for ; + Sat, 2 Jul 2005 00:15:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76535-06 + for ; + Sat, 2 Jul 2005 03:15:01 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id E2C8352801 + for ; + Sat, 2 Jul 2005 00:14:58 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050702031454m92008hqove>; Sat, 2 Jul 2005 03:14:54 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id CBD85560B3; Fri, 1 Jul 2005 22:14:53 -0500 (CDT) +Received: from [192.168.1.11] (liliana.arbash-meinel.com [192.168.1.11]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 70BFA56070; + Fri, 1 Jul 2005 22:14:50 -0500 (CDT) +Message-ID: <42C606AA.8060406@arbash-meinel.com> +Date: Fri, 01 Jul 2005 22:14:50 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: emil@baymountain.com, + Postgresql Performance +Subject: Re: Planner constants for RAM resident databases +References: <200507012159.39041.emil@baymountain.com> + <42C5FFB9.9050302@arbash-meinel.com> + <200507012311.37942.emil@baymountain.com> +In-Reply-To: <200507012311.37942.emil@baymountain.com> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig6532213C64F4D9578C5667D0" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/11 +X-Sequence-Number: 13252 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig6532213C64F4D9578C5667D0 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit + +Emil Briggs wrote: + +>>I just mentioned random_page_cost, but you should also tune +>>effective_cache_size, since that is effectively most of your RAM. It +>>depends what else is going on in the system, but setting it as high as +>>say 12-14GB is probably reasonable if it is a dedicated machine. With +>>random_page_cost 1.5-2, and higher effective_cache_size, you should be +>>doing pretty well. +>>John +>>=:-> +>> +>> +> +>I tried playing around with these and they had no effect. It seems the only +>thing that makes a difference is cpu_tuple_cost. +> +> +> +I'm surprised. I know cpu_tuple_cost can effect it as well, but usually +the recommended way to get indexed scans is the above two parameters. + +When you do "explain analyze" of a query that you have difficulties +with, how are the planner's estimates. Are the estimated number of rows +about equal to the actual number of rows? +If the planner is mis-estimating, there is a whole different set of +tuning to do to help it estimate correctly. + +John +=:-> + +PS> Use reply-all so that your comments go to the list. + +--------------enig6532213C64F4D9578C5667D0 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCxgaqJdeBCYSNAAMRAv9IAJ9KadS2PKPBL2jSFouJJcaG86+A8QCdGKdz +Ivx8YqiiBA+DUJ14kL+P3Ww= +=a9/R +-----END PGP SIGNATURE----- + +--------------enig6532213C64F4D9578C5667D0-- + +From pgsql-performance-owner@postgresql.org Sat Jul 2 09:09:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5B635529F5 + for ; + Sat, 2 Jul 2005 09:09:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94221-07 + for ; + Sat, 2 Jul 2005 12:09:03 +0000 (GMT) +Received: from tomts36-srv.bellnexxia.net (tomts36-srv.bellnexxia.net + [209.226.175.93]) + by svr1.postgresql.org (Postfix) with ESMTP id 5365F528B8 + for ; + Sat, 2 Jul 2005 09:09:02 -0300 (ADT) +Received: from [192.168.1.99] ([64.229.154.120]) by tomts36-srv.bellnexxia.net + (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP + id <20050702120903.HXMU16985.tomts36-srv.bellnexxia.net@[192.168.1.99]> + for ; + Sat, 2 Jul 2005 08:09:03 -0400 +Message-ID: <42C61537.3080601@alteeve.com> +Date: Sat, 02 Jul 2005 00:16:55 -0400 +From: Madison Kelly +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 +X-Accept-Language: en-us, en, ja +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: B-Tree index not being used +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.105 tagged_above=0 required=5 tests=AWL, + DATE_IN_PAST_06_12 +X-Spam-Level: +X-Archive-Number: 200507/13 +X-Sequence-Number: 13254 + +Hi all, + + I have gone back to my index problem from a while ago where I am +trying to do an update with a regex on the WHERE column. If I specifiy a +constant the index is used so that much I know is working. + + I've been reading the 7.4 docs and I saw that a B-Tree index *should* +but used when the regex is anchored to the start. This is from 11.2 of +the docs; It says "The optimizer can also use a B-tree indexfor queries +involving pattern matching operators LIKE, ILIKE, ~, and ~*, if, the +pattern is anchored to the beginning of the string." In my case that is +what I will always do. + + Specifically, this is a backup program I am using the DB for. The +table I am working on stores all the file and directory information for +a given partition. When the user toggles the checkbox for a given +directory (to indicate that they do or do not what that directory backed +up) I make a call to the DB telling it to change that column to given +state. + + When the user toggle a directory I want to propgate that change to +all sub directories and all files within those directories. The way I do +this is: + +UPDATE file_info_11 SET file_backup='t' WHERE file_parent_dir~'^/foo/bar'; + + Which basically is just to say "change every directory and file with +this parent directory and all sub directories to the new backup state". + From what I gather this query should have used the index. Here is what +I am actually getting though: + +tle-bu=> EXPLAIN ANALYZE UPDATE file_info_11 SET file_backup='t' WHERE +file_parent_dir~'^/'; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------- + Seq Scan on file_info_11 (cost=0.00..13484.23 rows=1 width=183) +(actual time=13.560..22040.603 rows=336039 loops=1) + Filter: (file_parent_dir ~ '^/'::text) + Total runtime: 514099.565 ms +(3 rows) + + Now if I define a static directory the index IS used: + +tle-bu=> EXPLAIN ANALYZE UPDATE file_info_11 SET file_backup='t' WHERE +file_parent_dir='/'; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------- + Index Scan using file_info_11_update_idx on file_info_11 +(cost=0.00..109.69 rows=66 width=183) (actual time=22.828..62.020 rows=3 +loops=1) + Index Cond: (file_parent_dir = '/'::text) + Total runtime: 88.334 ms +(3 rows) + + Here is the table and index schemas: + +tle-bu=> \d file_info_11; \d file_info_11_update_idx; + Table "public.file_info_11" + Column | Type | Modifiers +----------------------+----------------------+----------------------------------------- + file_group_name | text | + file_group_uid | bigint | not null + file_mod_time | bigint | not null + file_name | text | not null + file_parent_dir | text | not null + file_perm | text | not null + file_size | bigint | not null + file_type | character varying(2) | not null default +'f'::character varying + file_user_name | text | + file_user_uid | bigint | not null + file_backup | boolean | not null default true + file_display | boolean | not null default false + file_restore_display | boolean | not null default false + file_restore | boolean | not null default false +Indexes: + "file_info_11_display_idx" btree (file_type, file_parent_dir, +file_name) + "file_info_11_update_idx" btree (file_parent_dir) + +Index "public.file_info_11_update_idx" + Column | Type +-----------------+------ + file_parent_dir | text +btree, for table "public.file_info_11" + + + Can anyone see why the index might not be being used? + + I know that 'tsearch2' would probably work but it seems like way more +than I need (because I will never be searching the middle of a string). + +Thanks for any advice/help/pointers! + +Madison + +-- +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +Madison Kelly (Digimer) +TLE-BU, The Linux Experience; Back Up +http://tle-bu.thelinuxexperience.com +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + +From pgsql-performance-owner@postgresql.org Sat Jul 2 02:24:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 19C695288E + for ; + Sat, 2 Jul 2005 02:24:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03144-08 + for ; + Sat, 2 Jul 2005 05:24:33 +0000 (GMT) +Received: from zigo.dhs.org (ua-83-227-204-174.cust.bredbandsbolaget.se + [83.227.204.174]) + by svr1.postgresql.org (Postfix) with ESMTP id 66CF952867 + for ; + Sat, 2 Jul 2005 02:24:30 -0300 (ADT) +Received: from zigo.zigo.dhs.org (zigo.zigo.dhs.org [192.168.0.1]) + by zigo.dhs.org (Postfix) with ESMTP + id 7B6998467; Sat, 2 Jul 2005 07:24:26 +0200 (CEST) +Date: Sat, 2 Jul 2005 07:24:26 +0200 (CEST) +From: Dennis Bjorklund +To: Sam Mason +Cc: pgsql-performance@postgresql.org +Subject: Re: planner picking more expensive plan +In-Reply-To: <20050701133305.GB2623@sam.lan.samason.me.uk> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=ISO-8859-1 +Content-Transfer-Encoding: 8BIT +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.331 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/12 +X-Sequence-Number: 13253 + +On Fri, 1 Jul 2005, Sam Mason wrote: + +The key thing with the query that Sam have is that if you turn off seqscan +you get the first plan that run in 0.4ms and if seqscan is on the runtime +is 27851ms. + +There are 100 way to make it select the seq scan, including rewriting the +query to something more useful, tweaking different parameters and so on. + +The interesting part is that pg give the fast plan a cost of 202 and the +slow a cost of 566141, but still it chooses the slow query unless seqscan +is turned off (or some other tweak with the same effect). It know very +well that the plan with the index scan will be much faster, it just don't +manage to generate it unless you force it to. + +It makes you wonder if pg throws away some plans too early in the planning +phase. + +> Limit (cost=0.00..202.52 rows=10 width=8) (actual time=0.221..0.600 rows=10 loops=1) +> -> Merge Left Join (cost=0.00..66888828.30 rows=3302780 width=8) (actual time=0.211..0.576 rows=10 loops=1) +> Merge Cond: ("outer".animalid = "inner".animalid) +> -> Index Scan using animals_pkey on animals a (cost=0.00..10198983.91 rows=3302780 width=8) (actual time=0.112..0.276 rows=10 loops=1) +> -> Index Scan using movement_animal on movements m (cost=0.00..56642740.73 rows=3107737 width=8) (actual time=0.088..0.235 rows=10 loops=1) +> Filter: (mtypeid = 0) +> Total runtime: 0.413 ms +> +> Limit (cost=565969.42..566141.09 rows=10 width=8) (actual time=27769.047..27769.246 rows=10 loops=1) +> -> Merge Right Join (cost=565969.42..57264070.77 rows=3302780 width=8) (actual time=27769.043..27769.228 rows=10 loops=1) +> Merge Cond: ("outer".animalid = "inner".animalid) +> -> Index Scan using movement_animal on movements m (cost=0.00..56642740.73 rows=3107737 width=8) (actual time=0.022..0.154 rows=10 loops=1) +> Filter: (mtypeid = 0) +> -> Sort (cost=565969.42..574226.37 rows=3302780 width=8) (actual time=27768.991..27769.001 rows=10 loops=1) +> Sort Key: a.animalid +> -> Seq Scan on animals a (cost=0.00..77086.80 rows=3302780 width=8) (actual time=0.039..5620.651 rows=3303418 loops=1) +> Total runtime: 27851.097 ms + + +Another thing to notice is that if one remove the Limit node then the +situation is reversed and the plan that pg choose (with the Limit node) is +the one with the lowest cost. The startup cost is however very high so +combining that Merge Join with a Limit will of course produce something +slow compared to the upper plan where the startup cost is 0.0. + +A stand alone test case would be nice, but even without the above plans +are interesting. + +-- +/Dennis Bj�rklund + + +From pgsql-performance-owner@postgresql.org Sat Jul 2 10:44:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 75A29529C2 + for ; + Sat, 2 Jul 2005 10:44:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18485-04 + for ; + Sat, 2 Jul 2005 13:44:10 +0000 (GMT) +Received: from mail.baymountain.com (mail.baymountain.com [8.7.96.19]) + by svr1.postgresql.org (Postfix) with SMTP id C2014529D8 + for ; + Sat, 2 Jul 2005 10:44:08 -0300 (ADT) +Received: (qmail 23726 invoked by uid 504); 2 Jul 2005 13:44:11 -0000 +Received: from emil@baymountain.com by mail.baymountain.com by uid 501 with + qmail-scanner-1.16 (spamassassin: 2.53. Clear:SA:0(0.0/7.0):. + Processed in 0.245709 secs); 02 Jul 2005 13:44:11 -0000 +Received: from unknown (HELO briggspack.com) + (emil@briggspack.com@24.211.148.77) + by mail.baymountain.com with SMTP; 2 Jul 2005 13:44:11 -0000 +From: Emil Briggs +Reply-To: emil@baymountain.com +Organization: Baymountain, Inc. +To: John A Meinel +Subject: Re: Planner constants for RAM resident databases +Date: Sat, 2 Jul 2005 09:44:07 -0400 +User-Agent: KMail/1.7.1 +Cc: Postgresql Performance +References: <200507012159.39041.emil@baymountain.com> + <200507012311.37942.emil@baymountain.com> + <42C606AA.8060406@arbash-meinel.com> +In-Reply-To: <42C606AA.8060406@arbash-meinel.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200507020944.07339.emil@baymountain.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/14 +X-Sequence-Number: 13255 + +> When you do "explain analyze" of a query that you have difficulties +> with, how are the planner's estimates. Are the estimated number of rows +> about equal to the actual number of rows? + +Some of them are pretty far off. For example + + -> Merge Left Join (cost=9707.71..13993.52 rows=1276 width=161) (actual +time=164.423..361.477 rows=49 loops=1) + +I tried setting enable_merge_joins to off and that made the query about three +times faster. It's using a hash join instead. + +From pgsql-performance-owner@postgresql.org Sat Jul 2 10:54:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4D2B8529C2 + for ; + Sat, 2 Jul 2005 10:54:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20937-01 + for ; + Sat, 2 Jul 2005 13:54:37 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E726C5299F + for ; + Sat, 2 Jul 2005 10:54:36 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j62DseIu025043; + Sat, 2 Jul 2005 09:54:40 -0400 (EDT) +To: Madison Kelly +Cc: pgsql-performance@postgresql.org +Subject: Re: B-Tree index not being used +In-reply-to: <42C61537.3080601@alteeve.com> +References: <42C61537.3080601@alteeve.com> +Comments: In-reply-to Madison Kelly + message dated "Sat, 02 Jul 2005 00:16:55 -0400" +Date: Sat, 02 Jul 2005 09:54:40 -0400 +Message-ID: <25042.1120312480@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/15 +X-Sequence-Number: 13256 + +Madison Kelly writes: +> Can anyone see why the index might not be being used? + +You didn't initdb in 'C' locale. You can either re-initdb, +or create a specialized index with a non-default operator class +to support LIKE. See the documentation. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Jul 2 12:20:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DC2B85293E + for ; + Sat, 2 Jul 2005 12:20:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34842-07 + for ; + Sat, 2 Jul 2005 15:20:31 +0000 (GMT) +Received: from tomts20-srv.bellnexxia.net (tomts20-srv.bellnexxia.net + [209.226.175.74]) + by svr1.postgresql.org (Postfix) with ESMTP id 5847D52923 + for ; + Sat, 2 Jul 2005 12:20:30 -0300 (ADT) +Received: from [192.168.1.99] ([64.228.1.109]) by tomts20-srv.bellnexxia.net + (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP + id <20050702152029.UYZG19894.tomts20-srv.bellnexxia.net@[192.168.1.99]>; + Sat, 2 Jul 2005 11:20:29 -0400 +Message-ID: <42C6B0B7.5010006@alteeve.com> +Date: Sat, 02 Jul 2005 11:20:23 -0400 +From: Madison Kelly +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 +X-Accept-Language: en-us, en, ja +MIME-Version: 1.0 +To: Tom Lane +Cc: pgsql-performance@postgresql.org +Subject: Re: B-Tree index not being used +References: <42C61537.3080601@alteeve.com> <25042.1120312480@sss.pgh.pa.us> +In-Reply-To: <25042.1120312480@sss.pgh.pa.us> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/16 +X-Sequence-Number: 13257 + +Tom Lane wrote: +> Madison Kelly writes: +> +>> Can anyone see why the index might not be being used? +> +> +> You didn't initdb in 'C' locale. You can either re-initdb, +> or create a specialized index with a non-default operator class +> to support LIKE. See the documentation. +> +> regards, tom lane + +I'll look into the non-default op class. I want to keep anything that +tweaks the DB in my code so that a user doesn't need to modify anything +on their system. + +Thanks! + +Madison + +-- +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +Madison Kelly (Digimer) +TLE-BU, The Linux Experience; Back Up +http://tle-bu.thelinuxexperience.com +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +From pgsql-performance-owner@postgresql.org Sun Jul 3 20:29:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B00B652834 + for ; + Sun, 3 Jul 2005 20:29:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44749-09 + for ; + Sun, 3 Jul 2005 23:29:26 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 0ED6D5282C + for ; + Sun, 3 Jul 2005 20:29:24 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j63MSURN008589 + for pgsql-performance@postgresql.org; Mon, 4 Jul 2005 00:28:30 +0200 +Date: Mon, 4 Jul 2005 00:28:30 +0200 +From: Enrico Weigelt +To: pgsql-performance@postgresql.org +Subject: Re: investigating slow queries through pg_stat_activity +Message-ID: <20050703222830.GA2056@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: pgsql-performance@postgresql.org +References: <0B5C29FA-E949-447E-AEFE-A806E238F1C2@drivefaster.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <0B5C29FA-E949-447E-AEFE-A806E238F1C2@drivefaster.net> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/17 +X-Sequence-Number: 13258 + +* Dan Harris wrote: + +Hi, + +> I've got some queries generated by my application that will, for some +> reason, run forever until I kill the pid. Yet, when I run the +> queries manually to check them out, they usually work fine. + +If you can change your application, you could try to encapsulate the +queries into views - this makes logging and tracking down problems +much easier. + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de +--------------------------------------------------------------------- + Realtime Forex/Stock Exchange trading powered by postgresSQL :)) + http://www.fxignal.net/ +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Sun Jul 3 20:46:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D109C52846 + for ; + Sun, 3 Jul 2005 20:46:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54414-07 + for ; + Sun, 3 Jul 2005 23:46:34 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 473C452809 + for ; + Sun, 3 Jul 2005 20:46:32 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j63Mjckt011851 + for pgsql-performance@postgresql.org; Mon, 4 Jul 2005 00:45:38 +0200 +Date: Mon, 4 Jul 2005 00:45:37 +0200 +From: Enrico Weigelt +To: postgresql performance list +Subject: plain inserts and deletes very slow +Message-ID: <20050703224537.GA9777@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: postgresql performance list + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/18 +X-Sequence-Number: 13259 + + +Hi folks, + + +my application reads and writes some table quite often +(multiple times per second). these tables are quite small +(not more than 20 tuples), but the operations take quite a +long time (>300 ms!). + +The query operations are just include text matching (=) and +date comparison (<,>). + +I wasn't yet able to track down, if all these queries take +sucha long time or just sometimes. When running them manually +or trying explain, evrything's fast. Probably there could be +some side effects with other concurrent quries. + + +Could anyone give me advice ? + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de +--------------------------------------------------------------------- + Realtime Forex/Stock Exchange trading powered by postgresSQL :)) + http://www.fxignal.net/ +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Sun Jul 3 20:58:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 36D1952867 + for ; + Sun, 3 Jul 2005 20:58:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56234-07 + for ; + Sun, 3 Jul 2005 23:58:03 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 810E852834 + for ; + Sun, 3 Jul 2005 20:58:01 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j63Mv7RF013155 + for pgsql-performance@postgresql.org; Mon, 4 Jul 2005 00:57:07 +0200 +Date: Mon, 4 Jul 2005 00:57:07 +0200 +From: Enrico Weigelt +To: postgresql performance list +Subject: Re: plain inserts and deletes very slow +Message-ID: <20050703225707.GB9777@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: postgresql performance list + +References: <20050703224537.GA9777@nibiru.borg.metux.de> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050703224537.GA9777@nibiru.borg.metux.de> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/20 +X-Sequence-Number: 13261 + +* Enrico Weigelt wrote: + +forgot to mention: + + + linux-2.6.9 + + postgres-7.4.6 + + intel celeron 2ghz + + intel ultra ata controller + + 768mb ram + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de +--------------------------------------------------------------------- + Realtime Forex/Stock Exchange trading powered by postgresSQL :)) + http://www.fxignal.net/ +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Sun Jul 3 20:58:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 99A8652896 + for ; + Sun, 3 Jul 2005 20:58:55 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62330-02 + for ; + Sun, 3 Jul 2005 23:58:54 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 2C33152882 + for ; + Sun, 3 Jul 2005 20:58:52 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j63MvxA3013173 + for pgsql-performance@postgresql.org; Mon, 4 Jul 2005 00:57:59 +0200 +Date: Mon, 4 Jul 2005 00:57:59 +0200 +From: Enrico Weigelt +To: postgresql performance list +Subject: Re: plain inserts and deletes very slow +Message-ID: <20050703225759.GC9777@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: postgresql performance list + +References: <20050703224537.GA9777@nibiru.borg.metux.de> + <20050703235424.GA16122@uio.no> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050703235424.GA16122@uio.no> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/21 +X-Sequence-Number: 13262 + +* Steinar H. Gunderson wrote: +> On Mon, Jul 04, 2005 at 12:45:37AM +0200, Enrico Weigelt wrote: +> > my application reads and writes some table quite often +> > (multiple times per second). these tables are quite small +> > (not more than 20 tuples), but the operations take quite a +> > long time (>300 ms!). +> +> Are you VACUUMing often enough? + +I've just VACUUM'ed multiple times, so it's perhaps not the problem. + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de +--------------------------------------------------------------------- + Realtime Forex/Stock Exchange trading powered by postgresSQL :)) + http://www.fxignal.net/ +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Sun Jul 3 20:54:32 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 008285284D + for ; + Sun, 3 Jul 2005 20:54:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53729-08 + for ; + Sun, 3 Jul 2005 23:54:27 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id 8D84A52846 + for ; + Sun, 3 Jul 2005 20:54:26 -0300 (ADT) +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 1DpEI5-0001uT-B7 + for pgsql-performance@postgresql.org; Mon, 04 Jul 2005 01:54:26 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1DpEI4-0004DV-00 + for ; Mon, 04 Jul 2005 01:54:24 +0200 +Date: Mon, 4 Jul 2005 01:54:24 +0200 +From: "Steinar H. Gunderson" +To: postgresql performance list +Subject: Re: plain inserts and deletes very slow +Message-ID: <20050703235424.GA16122@uio.no> +Mail-Followup-To: postgresql performance list + +References: <20050703224537.GA9777@nibiru.borg.metux.de> +Mime-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <20050703224537.GA9777@nibiru.borg.metux.de> +X-Operating-System: Linux 2.6.11.8 on a i686 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.019 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/19 +X-Sequence-Number: 13260 + +On Mon, Jul 04, 2005 at 12:45:37AM +0200, Enrico Weigelt wrote: +> my application reads and writes some table quite often +> (multiple times per second). these tables are quite small +> (not more than 20 tuples), but the operations take quite a +> long time (>300 ms!). + +Are you VACUUMing often enough? + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Sun Jul 3 22:03:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EF14C52809 + for ; + Sun, 3 Jul 2005 22:03:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76170-01 + for ; + Mon, 4 Jul 2005 01:02:53 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 3202D528AD + for ; + Sun, 3 Jul 2005 22:02:51 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j6401vQF024275 + for pgsql-performance@postgresql.org; Mon, 4 Jul 2005 02:01:57 +0200 +Date: Mon, 4 Jul 2005 02:01:57 +0200 +From: Enrico Weigelt +To: postgresql performance list +Subject: Re: plain inserts and deletes very slow +Message-ID: <20050704000157.GD9777@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: postgresql performance list + +References: <20050703224537.GA9777@nibiru.borg.metux.de> + <20050703225707.GB9777@nibiru.borg.metux.de> + <42C887DC.40308@telogis.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42C887DC.40308@telogis.com> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/23 +X-Sequence-Number: 13264 + +* David Mitchell wrote: +> Did you vacuum full? +> +> When you do lots of inserts and deletes, dead tuples get left behind. +> When you vacuum, postgres will reuse those dead tuples, but if you don't +> vacuum for a long time these tuples will build up lots. Even when you +> vacuum in this case, the dead tuples are still there, although they are +> marked for reuse. Vacuuming full actually removes the dead tuples. + +I'm doing a VACUUM ANALYZE every 6 hours. + +vacuum'ing manually doesnt seem to have any effect on that. + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de +--------------------------------------------------------------------- + Realtime Forex/Stock Exchange trading powered by postgresSQL :)) + http://www.fxignal.net/ +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Sun Jul 3 22:18:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 38360528B1 + for ; + Sun, 3 Jul 2005 22:18:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76159-03 + for ; + Mon, 4 Jul 2005 01:18:43 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 5C83A528A9 + for ; + Sun, 3 Jul 2005 22:18:41 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j640HlXN027352 + for pgsql-performance@postgresql.org; Mon, 4 Jul 2005 02:17:47 +0200 +Date: Mon, 4 Jul 2005 02:17:47 +0200 +From: Enrico Weigelt +To: postgresql performance list +Subject: Re: plain inserts and deletes very slow +Message-ID: <20050704001747.GE9777@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: postgresql performance list + +References: <20050703224537.GA9777@nibiru.borg.metux.de> + <20050703225707.GB9777@nibiru.borg.metux.de> + <42C887DC.40308@telogis.com> + <20050704000157.GD9777@nibiru.borg.metux.de> + <42C88D17.4080004@telogis.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42C88D17.4080004@telogis.com> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/25 +X-Sequence-Number: 13266 + +* David Mitchell wrote: +> Perhaps if you are doing a lot of inserts and deletes, vacuuming every 6 +> minutes would be closer to your mark. Try vacuuming every 15 minutes for +> a start and see how that affects things (you will have to do a vacuum +> full to get the tables back into shape after them slowing down as they +> have). + +hmm. I've just done vacuum full at the moment on these tables, but it +doesnt seem to change anything :( + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de +--------------------------------------------------------------------- + Realtime Forex/Stock Exchange trading powered by postgresSQL :)) + http://www.fxignal.net/ +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Sun Jul 3 21:50:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8BA5A528B4 + for ; + Sun, 3 Jul 2005 21:50:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71240-09 + for ; + Mon, 4 Jul 2005 00:50:43 +0000 (GMT) +Received: from smtp004.bizmail.sc5.yahoo.com (smtp004.bizmail.sc5.yahoo.com + [66.163.175.81]) + by svr1.postgresql.org (Postfix) with SMTP id A957B528AD + for ; + Sun, 3 Jul 2005 21:50:41 -0300 (ADT) +Received: (qmail 41774 invoked from network); 4 Jul 2005 00:50:44 -0000 +Received: from unknown (HELO ?192.168.3.41?) + (david.mitchell@telogis.com@203.98.10.169 with plain) + by smtp004.bizmail.sc5.yahoo.com with SMTP; 4 Jul 2005 00:50:44 -0000 +Message-ID: <42C887DC.40308@telogis.com> +Date: Mon, 04 Jul 2005 12:50:36 +1200 +From: David Mitchell +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: weigelt@metux.de +Cc: postgresql performance list +Subject: Re: plain inserts and deletes very slow +References: <20050703224537.GA9777@nibiru.borg.metux.de> + <20050703225707.GB9777@nibiru.borg.metux.de> +In-Reply-To: <20050703225707.GB9777@nibiru.borg.metux.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-Archive-Number: 200507/22 +X-Sequence-Number: 13263 + +Did you vacuum full? + +When you do lots of inserts and deletes, dead tuples get left behind. +When you vacuum, postgres will reuse those dead tuples, but if you don't +vacuum for a long time these tuples will build up lots. Even when you +vacuum in this case, the dead tuples are still there, although they are +marked for reuse. Vacuuming full actually removes the dead tuples. + +If you vacuum (normal) regularly, then the number of dead tuples will +stay down, as they are regularly marked for reuse. + +David + +Enrico Weigelt wrote: +> * Enrico Weigelt wrote: +> +> forgot to mention: +> +> + linux-2.6.9 +> + postgres-7.4.6 +> + intel celeron 2ghz +> + intel ultra ata controller +> + 768mb ram +> +> +> cu + + +-- +David Mitchell +Software Engineer +Telogis + +NOTICE: +This message (including any attachments) contains CONFIDENTIAL +INFORMATION intended for a specific individual and purpose, and +is protected by law. If you are not the intended recipient, +you should delete this message and are hereby notified that any +disclosure, copying, or distribution of this message, or the +taking of any action based on it, is strictly prohibited. + +From pgsql-performance-owner@postgresql.org Sun Jul 3 22:13:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 88F38528AD + for ; + Sun, 3 Jul 2005 22:13:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74199-10 + for ; + Mon, 4 Jul 2005 01:13:00 +0000 (GMT) +Received: from smtp005.bizmail.sc5.yahoo.com (smtp005.bizmail.sc5.yahoo.com + [66.163.175.82]) + by svr1.postgresql.org (Postfix) with SMTP id 357CF52828 + for ; + Sun, 3 Jul 2005 22:12:59 -0300 (ADT) +Received: (qmail 60666 invoked from network); 4 Jul 2005 01:13:02 -0000 +Received: from unknown (HELO ?192.168.3.41?) + (david.mitchell@telogis.com@203.98.10.169 with plain) + by smtp005.bizmail.sc5.yahoo.com with SMTP; 4 Jul 2005 01:13:02 -0000 +Message-ID: <42C88D17.4080004@telogis.com> +Date: Mon, 04 Jul 2005 13:12:55 +1200 +From: David Mitchell +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: weigelt@metux.de +Cc: postgresql performance list +Subject: Re: plain inserts and deletes very slow +References: <20050703224537.GA9777@nibiru.borg.metux.de> + <20050703225707.GB9777@nibiru.borg.metux.de> + <42C887DC.40308@telogis.com> + <20050704000157.GD9777@nibiru.borg.metux.de> +In-Reply-To: <20050704000157.GD9777@nibiru.borg.metux.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-Archive-Number: 200507/24 +X-Sequence-Number: 13265 + +Perhaps if you are doing a lot of inserts and deletes, vacuuming every 6 +minutes would be closer to your mark. Try vacuuming every 15 minutes for +a start and see how that affects things (you will have to do a vacuum +full to get the tables back into shape after them slowing down as they +have). + +David + +Enrico Weigelt wrote: +> * David Mitchell wrote: +> +>>Did you vacuum full? +>> +>>When you do lots of inserts and deletes, dead tuples get left behind. +>>When you vacuum, postgres will reuse those dead tuples, but if you don't +>>vacuum for a long time these tuples will build up lots. Even when you +>>vacuum in this case, the dead tuples are still there, although they are +>>marked for reuse. Vacuuming full actually removes the dead tuples. +> +> +> I'm doing a VACUUM ANALYZE every 6 hours. +> +> vacuum'ing manually doesnt seem to have any effect on that. +> +> +> cu + + +-- +David Mitchell +Software Engineer +Telogis + +NOTICE: +This message (including any attachments) contains CONFIDENTIAL +INFORMATION intended for a specific individual and purpose, and +is protected by law. If you are not the intended recipient, +you should delete this message and are hereby notified that any +disclosure, copying, or distribution of this message, or the +taking of any action based on it, is strictly prohibited. + +From pgsql-performance-owner@postgresql.org Mon Jul 4 00:09:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 40381528A6 + for ; + Mon, 4 Jul 2005 00:09:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01272-06 + for ; + Mon, 4 Jul 2005 03:09:46 +0000 (GMT) +Received: from mr2.surnet.cl (smtp2.surnet.cl [216.155.73.163]) + by svr1.postgresql.org (Postfix) with ESMTP id 816665288E + for ; + Mon, 4 Jul 2005 00:09:46 -0300 (ADT) +Received: from smtp2.surnet.cl (216.155.73.169) by mr2.surnet.cl (7.0.031.3) + id 4259ADFA012BF3FC for pgsql-performance@postgresql.org; + Sun, 3 Jul 2005 23:09:39 -0400 +Received: from smtp2.surnet.cl (mr2.surnet.cl []) + by mr2.surnet.cl ([216.155.73.169]); Mon, 04 Jul 2005 03:09:39 +0000 +Received: from cluster.surnet.cl (216.155.73.164) by smtp2.surnet.cl + (7.0.031.3) id 4259ADE300B65A19 for pgsql-performance@postgresql.org; + Sun, 3 Jul 2005 23:09:39 -0400 +Received: from alvh.no-ip.org (216.155.79.182) by cluster.surnet.cl (7.0.043) + (authenticated as alvherre@surnet.cl) + id 42B3EF6000224778 for pgsql-performance@postgresql.org; + Sun, 3 Jul 2005 23:09:45 -0400 +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id 86DCDC2DC70; Sun, 3 Jul 2005 23:10:04 -0400 (CLT) +Resent-From: alvherre@surnet.cl +Resent-Date: Sun, 3 Jul 2005 23:10:04 -0400 +Resent-Message-ID: <20050704031004.GI24255@alvh.no-ip.org> +Resent-To: pgsql-performance@postgresql.org +Date: Sun, 3 Jul 2005 22:57:09 -0400 +From: Alvaro Herrera +To: postgresql performance list +Subject: Re: plain inserts and deletes very slow +Message-ID: <20050704025709.GA24255@alvh.no-ip.org> +References: <20050703224537.GA9777@nibiru.borg.metux.de> + <20050703225707.GB9777@nibiru.borg.metux.de> + <42C887DC.40308@telogis.com> + <20050704000157.GD9777@nibiru.borg.metux.de> + <42C88D17.4080004@telogis.com> + <20050704001747.GE9777@nibiru.borg.metux.de> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050704001747.GE9777@nibiru.borg.metux.de> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.418 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, RCVD_IN_NJABL_PROXY +X-Spam-Level: * +X-Archive-Number: 200507/26 +X-Sequence-Number: 13267 + +On Mon, Jul 04, 2005 at 02:17:47AM +0200, Enrico Weigelt wrote: +> * David Mitchell wrote: +> > Perhaps if you are doing a lot of inserts and deletes, vacuuming every 6 +> > minutes would be closer to your mark. Try vacuuming every 15 minutes for +> > a start and see how that affects things (you will have to do a vacuum +> > full to get the tables back into shape after them slowing down as they +> > have). +> +> hmm. I've just done vacuum full at the moment on these tables, but it +> doesnt seem to change anything :( + +Maybe you need a REINDEX, if you have indexes on that table. Try that, +coupled with the frequent VACUUM suggestion. + +-- +Alvaro Herrera () +"World domination is proceeding according to plan" (Andrew Morton) + +From pgsql-performance-owner@postgresql.org Mon Jul 4 00:51:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 78F3152892 + for ; + Mon, 4 Jul 2005 00:51:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08543-09 + for ; + Mon, 4 Jul 2005 03:51:41 +0000 (GMT) +Received: from smtp008.bizmail.sc5.yahoo.com (smtp008.bizmail.sc5.yahoo.com + [66.163.170.74]) + by svr1.postgresql.org (Postfix) with SMTP id D7A8D52896 + for ; + Mon, 4 Jul 2005 00:51:36 -0300 (ADT) +Received: (qmail 62853 invoked from network); 4 Jul 2005 03:51:35 -0000 +Received: from unknown (HELO ?192.168.3.41?) + (david.mitchell@telogis.com@203.98.10.169 with plain) + by smtp008.bizmail.sc5.yahoo.com with SMTP; 4 Jul 2005 03:51:35 -0000 +Message-ID: <42C8B23F.4000400@telogis.com> +Date: Mon, 04 Jul 2005 15:51:27 +1200 +From: David Mitchell +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: weigelt@metux.de +Cc: postgresql performance list +Subject: Re: plain inserts and deletes very slow +References: <20050703224537.GA9777@nibiru.borg.metux.de> + <20050703225707.GB9777@nibiru.borg.metux.de> + <42C887DC.40308@telogis.com> + <20050704000157.GD9777@nibiru.borg.metux.de> + <42C88D17.4080004@telogis.com> + <20050704001747.GE9777@nibiru.borg.metux.de> +In-Reply-To: <20050704001747.GE9777@nibiru.borg.metux.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-Archive-Number: 200507/27 +X-Sequence-Number: 13268 + +Hmm, you said you don't experience this when executing the query +manually. What adapter are you using to access postgres from your +application? libpq, npgsql or something else? And what is your method +for running the query 'manually'. Are you running it locally or from a +remote machine or what? + +Regards + +David + +Enrico Weigelt wrote: +> * David Mitchell wrote: +> +>>Perhaps if you are doing a lot of inserts and deletes, vacuuming every 6 +>>minutes would be closer to your mark. Try vacuuming every 15 minutes for +>>a start and see how that affects things (you will have to do a vacuum +>>full to get the tables back into shape after them slowing down as they +>>have). +> +> +> hmm. I've just done vacuum full at the moment on these tables, but it +> doesnt seem to change anything :( +> +> +> cu + + +-- +David Mitchell +Software Engineer +Telogis + +From pgsql-performance-owner@postgresql.org Mon Jul 4 06:58:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EE3CA52809 + for ; + Mon, 4 Jul 2005 06:58:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79253-03 + for ; + Mon, 4 Jul 2005 09:58:39 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 959F85281B + for ; + Mon, 4 Jul 2005 06:58:27 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j648vTjn014161 + for pgsql-performance@postgresql.org; Mon, 4 Jul 2005 10:57:29 +0200 +Date: Mon, 4 Jul 2005 10:57:29 +0200 +From: Enrico Weigelt +To: postgresql performance list +Subject: Re: plain inserts and deletes very slow +Message-ID: <20050704085729.GF9777@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: postgresql performance list + +References: <20050703224537.GA9777@nibiru.borg.metux.de> + <20050703225707.GB9777@nibiru.borg.metux.de> + <42C887DC.40308@telogis.com> + <20050704000157.GD9777@nibiru.borg.metux.de> + <42C88D17.4080004@telogis.com> + <20050704001747.GE9777@nibiru.borg.metux.de> + <20050704025709.GA24255@alvh.no-ip.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050704025709.GA24255@alvh.no-ip.org> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/28 +X-Sequence-Number: 13269 + +* Alvaro Herrera wrote: +> On Mon, Jul 04, 2005 at 02:17:47AM +0200, Enrico Weigelt wrote: +> > * David Mitchell wrote: +> > > Perhaps if you are doing a lot of inserts and deletes, vacuuming every 6 +> > > minutes would be closer to your mark. Try vacuuming every 15 minutes for +> > > a start and see how that affects things (you will have to do a vacuum +> > > full to get the tables back into shape after them slowing down as they +> > > have). +> > +> > hmm. I've just done vacuum full at the moment on these tables, but it +> > doesnt seem to change anything :( +> +> Maybe you need a REINDEX, if you have indexes on that table. Try that, +> coupled with the frequent VACUUM suggestion. + +I've tried it, but it doesn't seem to help :( + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de +--------------------------------------------------------------------- + Realtime Forex/Stock Exchange trading powered by postgresSQL :)) + http://www.fxignal.net/ +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Mon Jul 4 07:00:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 20F1752838 + for ; + Mon, 4 Jul 2005 07:00:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79269-04 + for ; + Mon, 4 Jul 2005 10:00:09 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 954E45282B + for ; + Mon, 4 Jul 2005 07:00:04 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j648x4gp014262 + for pgsql-performance@postgresql.org; Mon, 4 Jul 2005 10:59:04 +0200 +Date: Mon, 4 Jul 2005 10:59:03 +0200 +From: Enrico Weigelt +To: postgresql performance list +Subject: Re: plain inserts and deletes very slow +Message-ID: <20050704085903.GG9777@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: postgresql performance list + +References: <20050703224537.GA9777@nibiru.borg.metux.de> + <20050703225707.GB9777@nibiru.borg.metux.de> + <42C887DC.40308@telogis.com> + <20050704000157.GD9777@nibiru.borg.metux.de> + <42C88D17.4080004@telogis.com> + <20050704001747.GE9777@nibiru.borg.metux.de> + <42C8B23F.4000400@telogis.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42C8B23F.4000400@telogis.com> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/29 +X-Sequence-Number: 13270 + +* David Mitchell wrote: + +Hi, + +> Hmm, you said you don't experience this when executing the query +> manually. What adapter are you using to access postgres from your +> application? libpq, npgsql or something else? + +huh, its a delphi application ... (I didnt code it). + +> And what is your method for running the query 'manually'. Are you +> running it locally or from a remote machine or what? +using psql remotely - database and client machines are sitting +on the same wire. + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de +--------------------------------------------------------------------- + Realtime Forex/Stock Exchange trading powered by postgresSQL :)) + http://www.fxignal.net/ +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Mon Jul 4 11:27:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9537F5286E + for ; + Mon, 4 Jul 2005 11:27:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30152-01 + for ; + Mon, 4 Jul 2005 14:27:32 +0000 (GMT) +Received: from mr1.surnet.cl (smtp1.surnet.cl [216.155.73.162]) + by svr1.postgresql.org (Postfix) with ESMTP id D07D352806 + for ; + Mon, 4 Jul 2005 11:27:30 -0300 (ADT) +Received: from smtp1.surnet.cl (216.155.73.168) by mr1.surnet.cl (7.0.031.3) + id 42587EDE012D2108 for pgsql-performance@postgresql.org; + Mon, 4 Jul 2005 10:26:59 -0400 +Received: from smtp1.surnet.cl (mr1.surnet.cl []) + by mr1.surnet.cl ([216.155.73.168]); Mon, 04 Jul 2005 14:26:58 +0000 +Received: from cluster.surnet.cl (216.155.73.164) by smtp1.surnet.cl + (7.0.031.3) id 42587C6E00EA719F for pgsql-performance@postgresql.org; + Mon, 4 Jul 2005 10:26:58 -0400 +Received: from alvh.no-ip.org (216.155.79.182) by cluster.surnet.cl (7.0.043) + (authenticated as alvherre@surnet.cl) + id 42B3EF6000231915 for pgsql-performance@postgresql.org; + Mon, 4 Jul 2005 10:27:34 -0400 +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id 49A8BC2DC70; Mon, 4 Jul 2005 10:27:55 -0400 (CLT) +Date: Mon, 4 Jul 2005 10:27:55 -0400 +From: Alvaro Herrera +To: postgresql performance list +Subject: Re: plain inserts and deletes very slow +Message-ID: <20050704142755.GA12062@alvh.no-ip.org> +References: <20050703224537.GA9777@nibiru.borg.metux.de> + <20050703225707.GB9777@nibiru.borg.metux.de> + <42C887DC.40308@telogis.com> + <20050704000157.GD9777@nibiru.borg.metux.de> + <42C88D17.4080004@telogis.com> + <20050704001747.GE9777@nibiru.borg.metux.de> + <20050704025709.GA24255@alvh.no-ip.org> + <20050704085729.GF9777@nibiru.borg.metux.de> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <20050704085729.GF9777@nibiru.borg.metux.de> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.416 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, RCVD_IN_NJABL_PROXY +X-Spam-Level: * +X-Archive-Number: 200507/30 +X-Sequence-Number: 13271 + +On Mon, Jul 04, 2005 at 10:57:29AM +0200, Enrico Weigelt wrote: +> * Alvaro Herrera wrote: +> > On Mon, Jul 04, 2005 at 02:17:47AM +0200, Enrico Weigelt wrote: +> > > * David Mitchell wrote: +> > > > Perhaps if you are doing a lot of inserts and deletes, vacuuming every 6 +> > > > minutes would be closer to your mark. Try vacuuming every 15 minutes for +> > > > a start and see how that affects things (you will have to do a vacuum +> > > > full to get the tables back into shape after them slowing down as they +> > > > have). +> > > +> > > hmm. I've just done vacuum full at the moment on these tables, but it +> > > doesnt seem to change anything :( +> > +> > Maybe you need a REINDEX, if you have indexes on that table. Try that, +> > coupled with the frequent VACUUM suggestion. +> +> I've tried it, but it doesn't seem to help :( + +So, lets back up a little. You have no table nor index bloat, because +you reindexed and full-vacuumed. So where does the slowness come from? +Can you post an example EXPLAIN ANALYZE of the queries in question? + +-- +Alvaro Herrera () +"El realista sabe lo que quiere; el idealista quiere lo que sabe" (An�nimo) + +From pgsql-performance-owner@postgresql.org Mon Jul 4 16:55:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id ED502528BB + for ; + Mon, 4 Jul 2005 16:55:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92239-01 + for ; + Mon, 4 Jul 2005 19:55:38 +0000 (GMT) +Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) + by svr1.postgresql.org (Postfix) with ESMTP id 071FF5289B + for ; + Mon, 4 Jul 2005 16:55:37 -0300 (ADT) +Received: from [192.168.1.101] ([24.202.23.128]) by + VL-MO-MR011.ip.videotron.ca + (iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003)) + with ESMTP id <0IJ4008UCCIHLF@VL-MO-MR011.ip.videotron.ca> for + pgsql-performance@postgresql.org; Mon, 04 Jul 2005 15:51:53 -0400 (EDT) +Date: Mon, 04 Jul 2005 15:57:49 -0400 +From: David Gagnon +Subject: Why the planner is not using the INDEX . +In-reply-to: <20050630235821.GA2163@calvin.surfutopia.net> +Cc: pgsql-performance@postgresql.org +Message-id: <42C994BD.3000909@siunik.com> +MIME-version: 1.0 +Content-type: multipart/alternative; + boundary="Boundary_(ID_UtyElAxQHbaJrkD3SgFi5w)" +X-Accept-Language: en-us, en +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +References: <20050630222451.GA17628@calvin.surfutopia.net> + <42C473BA.9090305@commandprompt.com> + <20050630235821.GA2163@calvin.surfutopia.net> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.169 tagged_above=0 required=5 tests=AWL, HTML_60_70, + HTML_MESSAGE, HTML_TAG_EXIST_TBODY, HTML_TITLE_EMPTY +X-Spam-Level: +X-Archive-Number: 200507/31 +X-Sequence-Number: 13272 + +This is a multi-part message in MIME format. + +--Boundary_(ID_UtyElAxQHbaJrkD3SgFi5w) +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7BIT + +Hi all, + + If you can just help my understanding the choice of the planner. + +Here is the Query: + explain analyse SELECT IRNUM FROM IR + INNER JOIN IT ON IT.ITIRNUM = ANY ('{1000, 2000}') AND +IT.ITYPNUM = 'M' AND IR.IRYPNUM = IT.ITYPNUM AND IR.IRNUM = IT.ITIRNUM + WHERE IRNUM = ANY ('{1000, 2000}') and IRYPNUM = 'M' + +Here is the Query plan: + +QUERY PLAN + + + + + + +Hash Join (cost=1142.47..5581.75 rows=87 width=4) (actual +time=125.000..203.000 rows=2 loops=1) + Hash Cond: ("outer".itirnum = "inner".irnum) + + + + + -> Seq Scan on it (cost=0.00..3093.45 rows=31646 width=9) (actual +time=0.000..78.000 rows=2 loops=1) + Filter: ((itirnum = ANY ('{1000,2000}'::integer[])) AND +((itypnum)::text = 'M'::text)) + + -> Hash (cost=1142.09..1142.09 rows=151 width=37) (actual +time=125.000..125.000 rows=0 loops=1) + -> Index Scan using ir_pk on ir (cost=0.00..1142.09 rows=151 +width=37) (actual time=0.000..125.000 rows=2 loops=1) + Index Cond: ((irypnum)::text = 'M'::text) + + + + + Filter: (irnum = ANY ('{1000,2000}'::integer[])) + + + + +Total runtime: 203.000 ms + + + + + + + + + + + + + + + + + + + I don't understand why the planner do a Seq Scan (Seq Scan on table +IT ..) instead of passing by the followin index: + ALTER TABLE IT ADD CONSTRAINT IT_IR_FK foreign key (ITYPNUM,ITIRNUM) +references IR (IRYPNUM, IRNUM) ON UPDATE CASCADE; + +I tried some stuff but I'm not able to change this behavior. The IT and +IR table may be quite huge (from 20k to 1600k rows) so I think doing a +SEQ SCAN is not a good idea.. am I wrong? Is this query plan is oki for +you ? + +Thanks for your help. + +/David + P.S.: I'm using postgresql 8.0.3 on windows and I change those setting +in my postgresql.conf : +shared_buffers = 12000 # min 16, at least max_connections*2, 8KB each +work_mem = 15000 # min 64, size in KB + + + + +--Boundary_(ID_UtyElAxQHbaJrkD3SgFi5w) +Content-type: text/html; charset=ISO-8859-1 +Content-transfer-encoding: 7BIT + + + + + + + + +Hi all,
+
+  If you can just help my understanding the choice of the planner. 
+
+Here is the Query:
+ explain analyse SELECT IRNUM FROM IR
+        INNER JOIN IT ON  IT.ITIRNUM = ANY ('{1000, 2000}') AND +IT.ITYPNUM = 'M' AND IR.IRYPNUM = IT.ITYPNUM AND IR.IRNUM = IT.ITIRNUM  +
+        WHERE IRNUM = ANY ('{1000, 2000}') and IRYPNUM = 'M'
+
+Here is the Query plan:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
QUERY PLAN
+

+

+

+

+

+

+
Hash Join  (cost=1142.47..5581.75 rows=87 width=4) (actual +time=125.000..203.000 rows=2 loops=1)
+
  + Hash Cond: ("outer".itirnum = "inner".irnum)
+

+

+

+

+
  + ->  Seq Scan on it  + (cost=0.00..3093.45 rows=31646 width=9) (actual +time=0.000..78.000 rows=2 loops=1)
+
        + Filter: ((itirnum = ANY ('{1000,2000}'::integer[])) AND +((itypnum)::text = 'M'::text))
+

+
  + ->  Hash  (cost=1142.09..1142.09 +rows=151 width=37) (actual time=125.000..125.000 rows=0 loops=1)
+
        + ->  Index Scan using ir_pk on ir  (cost=0.00..1142.09 rows=151 width=37) (actual +time=0.000..125.000 rows=2 loops=1)
              + Index Cond: ((irypnum)::text = 'M'::text)
+

+

+

+

+
              + Filter: (irnum = ANY ('{1000,2000}'::integer[]))
+

+

+

+

+
Total +runtime: 203.000 ms
+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+
+
+
+    I don't understand why the planner do a Seq Scan (Seq Scan on table +IT ..) instead of passing by the followin index:
+    ALTER TABLE IT ADD CONSTRAINT IT_IR_FK foreign key +(ITYPNUM,ITIRNUM) references IR (IRYPNUM, IRNUM) ON UPDATE CASCADE;
+
+I tried some stuff but I'm not able to change this behavior.  The IT +and IR table may be quite huge (from 20k to 1600k rows) so I think +doing a SEQ SCAN is not a good idea.. am I wrong?  Is this query plan +is oki for you ?
+
+Thanks for your help.
+
+/David
+ P.S.: I'm using postgresql 8.0.3 on windows and I change those setting +in  my postgresql.conf :
+shared_buffers = 12000        # min 16, at least max_connections*2, 8KB +each
+work_mem = 15000        # min 64, size in KB
+
+
+
+ + + +--Boundary_(ID_UtyElAxQHbaJrkD3SgFi5w)-- + +From pgsql-performance-owner@postgresql.org Mon Jul 4 17:27:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1B53A52846 + for ; + Mon, 4 Jul 2005 17:27:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94578-06 + for ; + Mon, 4 Jul 2005 20:27:42 +0000 (GMT) +Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E24052808 + for ; + Mon, 4 Jul 2005 17:27:41 -0300 (ADT) +Received: by megazone.bigpanda.com (Postfix, from userid 1001) + id 12CB535578; Mon, 4 Jul 2005 13:27:41 -0700 (PDT) +Received: from localhost (localhost [127.0.0.1]) + by megazone.bigpanda.com (Postfix) with ESMTP + id 10DAF354C0; Mon, 4 Jul 2005 13:27:41 -0700 (PDT) +Date: Mon, 4 Jul 2005 13:27:41 -0700 (PDT) +From: Stephan Szabo +To: David Gagnon +Cc: pgsql-performance@postgresql.org +Subject: Re: Why the planner is not using the INDEX . +In-Reply-To: <42C994BD.3000909@siunik.com> +Message-ID: <20050704132446.O14579@megazone.bigpanda.com> +References: <20050630222451.GA17628@calvin.surfutopia.net> + <42C473BA.9090305@commandprompt.com> + <20050630235821.GA2163@calvin.surfutopia.net> + <42C994BD.3000909@siunik.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/32 +X-Sequence-Number: 13273 + +On Mon, 4 Jul 2005, David Gagnon wrote: + +> If you can just help my understanding the choice of the planner. +> +> Here is the Query: +> explain analyse SELECT IRNUM FROM IR +> INNER JOIN IT ON IT.ITIRNUM = ANY ('{1000, 2000}') AND +> IT.ITYPNUM = 'M' AND IR.IRYPNUM = IT.ITYPNUM AND IR.IRNUM = IT.ITIRNUM +> WHERE IRNUM = ANY ('{1000, 2000}') and IRYPNUM = 'M' +> +> Here is the Query plan: +> +> QUERY PLAN +> +> Hash Join (cost=1142.47..5581.75 rows=87 width=4) (actual +> time=125.000..203.000 rows=2 loops=1) +> Hash Cond: ("outer".itirnum = "inner".irnum) +> -> Seq Scan on it (cost=0.00..3093.45 rows=31646 width=9) (actual +> time=0.000..78.000 rows=2 loops=1) +> Filter: ((itirnum = ANY ('{1000,2000}'::integer[])) AND +> ((itypnum)::text = 'M'::text)) +> +> -> Hash (cost=1142.09..1142.09 rows=151 width=37) (actual +> time=125.000..125.000 rows=0 loops=1) +> -> Index Scan using ir_pk on ir (cost=0.00..1142.09 rows=151 +> width=37) (actual time=0.000..125.000 rows=2 loops=1) +> Index Cond: ((irypnum)::text = 'M'::text) +> Filter: (irnum = ANY ('{1000,2000}'::integer[])) +> Total runtime: 203.000 ms + +> I don't understand why the planner do a Seq Scan (Seq Scan on table +> IT ..) instead of passing by the followin index: +> ALTER TABLE IT ADD CONSTRAINT IT_IR_FK foreign key (ITYPNUM,ITIRNUM) +> references IR (IRYPNUM, IRNUM) ON UPDATE CASCADE; + +That doesn't create an index on IT. Primary keys (and unique constraints) +create indexes, but not foreign keys. Did you also create an index on +those fields? + +Also it looks like it's way overestimating the number of rows that +condition would succeed for. You might consider raising the statistics +targets on those columns and reanalyzing. + +From pgsql-performance-owner@postgresql.org Mon Jul 4 20:32:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 44E9B5282F + for ; + Mon, 4 Jul 2005 20:32:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 26360-05 + for ; + Mon, 4 Jul 2005 23:32:21 +0000 (GMT) +Received: from mailhub2.une.edu.au (mailhub2.une.edu.au [129.180.1.142]) + by svr1.postgresql.org (Postfix) with ESMTP id 5D5D052828 + for ; + Mon, 4 Jul 2005 20:32:19 -0300 (ADT) +Received: from icarus.une.edu.au (icarus.une.edu.au [129.180.47.120]) + by mailhub2.une.edu.au (Postfix) with ESMTP id EB53A7F8C; + Tue, 5 Jul 2005 09:32:22 +1000 (EST) +Received: from kgb (unknown [129.180.47.225]) + by icarus.une.edu.au (Postfix) with SMTP id 663D0355562; + Tue, 5 Jul 2005 09:32:22 +1000 (EST) +Date: Tue, 05 Jul 2005 09:36:02 +1000 +From: Klint Gore +To: weigelt@metux.de +Cc: postgresql performance list +Subject: Re: plain inserts and deletes very slow +In-Reply-To: <20050704085903.GG9777@nibiru.borg.metux.de> +References: <42C8B23F.4000400@telogis.com> + <20050704085903.GG9777@nibiru.borg.metux.de> +Message-Id: <42C9C7E278.E5BFKG@129.180.47.120> +MIME-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Mailer: Becky! ver 1.25.06 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/33 +X-Sequence-Number: 13274 + +On Mon, 4 Jul 2005 10:59:03 +0200, Enrico Weigelt wrote: +> * David Mitchell wrote: +> +> Hi, +> +> > Hmm, you said you don't experience this when executing the query +> > manually. What adapter are you using to access postgres from your +> > application? libpq, npgsql or something else? +> +> huh, its a delphi application ... (I didnt code it). + +Turn on statement logging. I've seen delphi interfaces do extra queries +on system tables to find some structure information. + +The available interfaces for delphi that I know of are vitavoom's +dbexpress (you should be able to find dbexppge.dll), zeos (you'll have +to grep the executable), ODBC using ADO or bde, Or dot net. + +klint. + ++---------------------------------------+-----------------+ +: Klint Gore : "Non rhyming : +: EMail : kg@kgb.une.edu.au : slang - the : +: Snail : A.B.R.I. : possibilities : +: Mail University of New England : are useless" : +: Armidale NSW 2351 Australia : L.J.J. : +: Fax : +61 2 6772 5376 : : ++---------------------------------------+-----------------+ + +From pgsql-performance-owner@postgresql.org Mon Jul 4 21:25:32 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 09268528C7 + for ; + Mon, 4 Jul 2005 21:25:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40363-01 + for ; + Tue, 5 Jul 2005 00:25:18 +0000 (GMT) +Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) + by svr1.postgresql.org (Postfix) with ESMTP id 3A5995288B + for ; + Mon, 4 Jul 2005 21:25:17 -0300 (ADT) +Received: from [192.168.1.101] ([24.202.23.128]) by + VL-MO-MR001.ip.videotron.ca + (iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003)) + with ESMTP id <0IJ400H2FP3VDT@VL-MO-MR001.ip.videotron.ca> for + pgsql-performance@postgresql.org; Mon, 04 Jul 2005 20:23:55 -0400 (EDT) +Date: Mon, 04 Jul 2005 20:29:50 -0400 +From: David Gagnon +Subject: Re: Why the planner is not using the INDEX . +In-reply-to: <20050704132446.O14579@megazone.bigpanda.com> +To: Stephan Szabo +Cc: pgsql-performance@postgresql.org +Message-id: <42C9D47E.7090103@siunik.com> +MIME-version: 1.0 +Content-type: multipart/alternative; + boundary="Boundary_(ID_/5SMBe2bXvLrkUkYZhz9qA)" +X-Accept-Language: en-us, en +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +References: <20050630222451.GA17628@calvin.surfutopia.net> + <42C473BA.9090305@commandprompt.com> + <20050630235821.GA2163@calvin.surfutopia.net> + <42C994BD.3000909@siunik.com> + <20050704132446.O14579@megazone.bigpanda.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.271 tagged_above=0 required=5 tests=AWL, HTML_20_30, + HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200507/34 +X-Sequence-Number: 13275 + +This is a multi-part message in MIME format. + +--Boundary_(ID_/5SMBe2bXvLrkUkYZhz9qA) +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7BIT + +Thanks .. I miss that FK don't create indexed ... since Primary key +implicitly does ... + +I'm a bit surprised of that behavior thought, since it means that if we +delete a row from table A all tables (B,C,D) with FK pointing to this +table (A) must be scanned. +If there is no index on those tables it means we gone do all Sequantial +scans. Than can cause significant performance problem!!!. + +Is there a reason why implicit index aren't created when FK are +declared. I looked into the documentation and I haven't found a way to +tell postgresql to automatically create an index when creating la FK. +Does it means I need to manage it EXPLICITLY with create index statement +? Is there another way ? + +Thanks for you help that simple answer will solve a lot of performance +problem I have ... + +/David + + +>On Mon, 4 Jul 2005, David Gagnon wrote: +> +> +> +>> If you can just help my understanding the choice of the planner. +>> +>>Here is the Query: +>> explain analyse SELECT IRNUM FROM IR +>> INNER JOIN IT ON IT.ITIRNUM = ANY ('{1000, 2000}') AND +>>IT.ITYPNUM = 'M' AND IR.IRYPNUM = IT.ITYPNUM AND IR.IRNUM = IT.ITIRNUM +>> WHERE IRNUM = ANY ('{1000, 2000}') and IRYPNUM = 'M' +>> +>>Here is the Query plan: +>> +>>QUERY PLAN +>> +>>Hash Join (cost=1142.47..5581.75 rows=87 width=4) (actual +>>time=125.000..203.000 rows=2 loops=1) +>> Hash Cond: ("outer".itirnum = "inner".irnum) +>> -> Seq Scan on it (cost=0.00..3093.45 rows=31646 width=9) (actual +>>time=0.000..78.000 rows=2 loops=1) +>> Filter: ((itirnum = ANY ('{1000,2000}'::integer[])) AND +>>((itypnum)::text = 'M'::text)) +>> +>> -> Hash (cost=1142.09..1142.09 rows=151 width=37) (actual +>>time=125.000..125.000 rows=0 loops=1) +>> -> Index Scan using ir_pk on ir (cost=0.00..1142.09 rows=151 +>>width=37) (actual time=0.000..125.000 rows=2 loops=1) +>> Index Cond: ((irypnum)::text = 'M'::text) +>> Filter: (irnum = ANY ('{1000,2000}'::integer[])) +>>Total runtime: 203.000 ms +>> +>> +> +> +> +>> I don't understand why the planner do a Seq Scan (Seq Scan on table +>>IT ..) instead of passing by the followin index: +>> ALTER TABLE IT ADD CONSTRAINT IT_IR_FK foreign key (ITYPNUM,ITIRNUM) +>>references IR (IRYPNUM, IRNUM) ON UPDATE CASCADE; +>> +>> +> +>That doesn't create an index on IT. Primary keys (and unique constraints) +>create indexes, but not foreign keys. Did you also create an index on +>those fields? +> +>Also it looks like it's way overestimating the number of rows that +>condition would succeed for. You might consider raising the statistics +>targets on those columns and reanalyzing. +> +> +> + +--Boundary_(ID_/5SMBe2bXvLrkUkYZhz9qA) +Content-type: text/html; charset=ISO-8859-1 +Content-transfer-encoding: 7BIT + + + + + + + +Thanks .. I miss that FK don't create indexed ...  since Primary key +implicitly does ...
+
+I'm a bit surprised of that behavior thought, since it means that if we +delete a row from table A all tables (B,C,D) with FK pointing to this +table (A) must be scanned. 
+If there is no index on those tables it means we gone do all Sequantial +scans. Than can cause significant performance problem!!!.
+
+Is there a reason why implicit index aren't created when FK are +declared.  I looked into the documentation and I haven't found a way to +tell postgresql to automatically create an index when creating la FK.  +Does it means I need to manage it EXPLICITLY with create index +statement ?  Is there another way ?
+
+Thanks for you help that simple answer will solve a lot of performance +problem I have ...
+
+/David
+
+
+
+
On Mon, 4 Jul 2005, David Gagnon wrote:
+
+  
+
+
  If you can just help my understanding the choice of the planner.
+
+Here is the Query:
+ explain analyse SELECT IRNUM FROM IR
+        INNER JOIN IT ON  IT.ITIRNUM = ANY ('{1000, 2000}') AND
+IT.ITYPNUM = 'M' AND IR.IRYPNUM = IT.ITYPNUM AND IR.IRNUM = IT.ITIRNUM
+        WHERE IRNUM = ANY ('{1000, 2000}') and IRYPNUM = 'M'
+
+Here is the Query plan:
+
+QUERY PLAN
+
+Hash Join  (cost=1142.47..5581.75 rows=87 width=4) (actual
+time=125.000..203.000 rows=2 loops=1)
+  Hash Cond: ("outer".itirnum = "inner".irnum)
+  ->  Seq Scan on it  (cost=0.00..3093.45 rows=31646 width=9) (actual
+time=0.000..78.000 rows=2 loops=1)
+        Filter: ((itirnum = ANY ('{1000,2000}'::integer[])) AND
+((itypnum)::text = 'M'::text))
+
+  ->  Hash  (cost=1142.09..1142.09 rows=151 width=37) (actual
+time=125.000..125.000 rows=0 loops=1)
+        ->  Index Scan using ir_pk on ir  (cost=0.00..1142.09 rows=151
+width=37) (actual time=0.000..125.000 rows=2 loops=1)
+              Index Cond: ((irypnum)::text = 'M'::text)
+              Filter: (irnum = ANY ('{1000,2000}'::integer[]))
+Total runtime: 203.000 ms
+    
+
+

+  
+
+
    I don't understand why the planner do a Seq Scan (Seq Scan on table
+IT ..) instead of passing by the followin index:
+    ALTER TABLE IT ADD CONSTRAINT IT_IR_FK foreign key (ITYPNUM,ITIRNUM)
+references IR (IRYPNUM, IRNUM) ON UPDATE CASCADE;
+    
+
+

+That doesn't create an index on IT.  Primary keys (and unique constraints)
+create indexes, but not foreign keys.  Did you also create an index on
+those fields?
+
+Also it looks like it's way overestimating the number of rows that
+condition would succeed for.  You might consider raising the statistics
+targets on those columns and reanalyzing.
+
+  
+
+ + + +--Boundary_(ID_/5SMBe2bXvLrkUkYZhz9qA)-- + +From pgsql-performance-owner@postgresql.org Mon Jul 4 22:12:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E81DD5284F + for ; + Mon, 4 Jul 2005 22:12:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47336-04 + for ; + Tue, 5 Jul 2005 01:12:46 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 82CC25282B + for ; + Mon, 4 Jul 2005 22:12:44 -0300 (ADT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 9A78724FDD; + Tue, 5 Jul 2005 09:12:45 +0800 (WST) +Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 9867E24FCE; + Tue, 5 Jul 2005 09:12:45 +0800 (WST) +Message-ID: <42C9DEBA.4000905@familyhealth.com.au> +Date: Tue, 05 Jul 2005 09:13:30 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: David Gagnon +Cc: Stephan Szabo , + pgsql-performance@postgresql.org +Subject: Re: Why the planner is not using the INDEX . +References: <20050630222451.GA17628@calvin.surfutopia.net> + <42C473BA.9090305@commandprompt.com> + <20050630235821.GA2163@calvin.surfutopia.net> + <42C994BD.3000909@siunik.com> + <20050704132446.O14579@megazone.bigpanda.com> + <42C9D47E.7090103@siunik.com> +In-Reply-To: <42C9D47E.7090103@siunik.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.063 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/35 +X-Sequence-Number: 13276 + +> I'm a bit surprised of that behavior thought, since it means that if we +> delete a row from table A all tables (B,C,D) with FK pointing to this +> table (A) must be scanned. +> If there is no index on those tables it means we gone do all Sequantial +> scans. Than can cause significant performance problem!!!. + +Correct. + +> Is there a reason why implicit index aren't created when FK are +> declared. + +Because it's not a requirement... + +> I looked into the documentation and I haven't found a way to +> tell postgresql to automatically create an index when creating la FK. +> Does it means I need to manage it EXPLICITLY with create index statement +> ? Is there another way ? + +No other way - you need to explicitly create them. It's not that hard +either to write a query to search the system catalogs for unindexed FK's. + +Chris + + +From pgsql-performance-owner@postgresql.org Tue Jul 5 09:32:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3464A5281E + for ; + Tue, 5 Jul 2005 09:32:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81210-05 + for ; + Tue, 5 Jul 2005 12:32:05 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.197.194]) + by svr1.postgresql.org (Postfix) with SMTP id 8E15352814 + for ; + Tue, 5 Jul 2005 09:32:03 -0300 (ADT) +Received: (qmail 11854 invoked by uid 500); 5 Jul 2005 12:32:17 -0000 +Date: Tue, 5 Jul 2005 07:32:17 -0500 +From: Bruno Wolff III +To: David Gagnon +Cc: Stephan Szabo , + pgsql-performance@postgresql.org +Subject: Re: Why the planner is not using the INDEX . +Message-ID: <20050705123217.GA11379@wolff.to> +Mail-Followup-To: Bruno Wolff III , + David Gagnon , + Stephan Szabo , + pgsql-performance@postgresql.org +References: <20050630222451.GA17628@calvin.surfutopia.net> + <42C473BA.9090305@commandprompt.com> + <20050630235821.GA2163@calvin.surfutopia.net> + <42C994BD.3000909@siunik.com> + <20050704132446.O14579@megazone.bigpanda.com> + <42C9D47E.7090103@siunik.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42C9D47E.7090103@siunik.com> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/36 +X-Sequence-Number: 13277 + +On Mon, Jul 04, 2005 at 20:29:50 -0400, + David Gagnon wrote: +> Thanks .. I miss that FK don't create indexed ... since Primary key +> implicitly does ... +> +> I'm a bit surprised of that behavior thought, since it means that if we +> delete a row from table A all tables (B,C,D) with FK pointing to this +> table (A) must be scanned. + +But in some applications you don't ever do that, so you don't save +anything by having the index for deletes but have to pay the cost to +update it when modifying the referencing table. + +If you think an index will help in your case, just create one. + +From pgsql-performance-owner@postgresql.org Tue Jul 5 11:02:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F214852969 + for ; + Tue, 5 Jul 2005 11:02:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02049-06 + for ; + Tue, 5 Jul 2005 14:02:03 +0000 (GMT) +Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) + by svr1.postgresql.org (Postfix) with ESMTP id F0BBE52968 + for ; + Tue, 5 Jul 2005 11:02:02 -0300 (ADT) +Received: by megazone.bigpanda.com (Postfix, from userid 1001) + id 19C143541C; Tue, 5 Jul 2005 07:02:07 -0700 (PDT) +Received: from localhost (localhost [127.0.0.1]) + by megazone.bigpanda.com (Postfix) with ESMTP + id 182F235408; Tue, 5 Jul 2005 07:02:07 -0700 (PDT) +Date: Tue, 5 Jul 2005 07:02:07 -0700 (PDT) +From: Stephan Szabo +To: David Gagnon +Cc: pgsql-performance@postgresql.org +Subject: Re: Why the planner is not using the INDEX . +In-Reply-To: <42C9D47E.7090103@siunik.com> +Message-ID: <20050705065351.W63027@megazone.bigpanda.com> +References: <20050630222451.GA17628@calvin.surfutopia.net> + <42C473BA.9090305@commandprompt.com> + <20050630235821.GA2163@calvin.surfutopia.net> + <42C994BD.3000909@siunik.com> + <20050704132446.O14579@megazone.bigpanda.com> + <42C9D47E.7090103@siunik.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/37 +X-Sequence-Number: 13278 + +On Mon, 4 Jul 2005, David Gagnon wrote: + +> Thanks .. I miss that FK don't create indexed ... since Primary key +> implicitly does ... +> +> I'm a bit surprised of that behavior thought, since it means that if we +> delete a row from table A all tables (B,C,D) with FK pointing to this +> table (A) must be scanned. +> If there is no index on those tables it means we gone do all Sequantial +> scans. Than can cause significant performance problem!!!. +> +> Is there a reason why implicit index aren't created when FK are +> declared. I looked into the documentation and I haven't found a way to + +The reason is that it's not always useful to have an index for that +purpose. You could either have low selectivity (in which case the index +wouldn't be used) or low/batch changes to the referenced table (in which +case the cost of maintaining the index may be greater than the value of +having the index) or other such cases. In primary key and unique, we +currently have no choice but to make an index because that's how the +constraint is currently implemented. + +> tell postgresql to automatically create an index when creating la FK. +> Does it means I need to manage it EXPLICITLY with create index statement +> ? + +Yeah. + +>Is there another way ? + +Not that I can think of without changing the source. + +From pgsql-performance-owner@postgresql.org Tue Jul 5 13:10:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6D8E45287F + for ; + Tue, 5 Jul 2005 13:10:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31547-02 + for ; + Tue, 5 Jul 2005 16:09:58 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8314152814 + for ; + Tue, 5 Jul 2005 13:09:57 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j65G9uL8023493; + Tue, 5 Jul 2005 12:09:56 -0400 (EDT) +To: David Gagnon +Cc: pgsql-performance@postgresql.org +Subject: Re: Why the planner is not using the INDEX . +In-reply-to: <42C994BD.3000909@siunik.com> +References: <20050630222451.GA17628@calvin.surfutopia.net> + <42C473BA.9090305@commandprompt.com> + <20050630235821.GA2163@calvin.surfutopia.net> + <42C994BD.3000909@siunik.com> +Comments: In-reply-to David Gagnon + message dated "Mon, 04 Jul 2005 15:57:49 -0400" +Date: Tue, 05 Jul 2005 12:09:56 -0400 +Message-ID: <23492.1120579796@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.109 tagged_above=0 required=5 tests=AWL, + UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200507/38 +X-Sequence-Number: 13279 + +David Gagnon writes: +> explain analyse SELECT IRNUM FROM IR +> INNER JOIN IT ON IT.ITIRNUM = ANY ('{1000, 2000}') AND +> IT.ITYPNUM = 'M' AND IR.IRYPNUM = IT.ITYPNUM AND IR.IRNUM = IT.ITIRNUM +> WHERE IRNUM = ANY ('{1000, 2000}') and IRYPNUM = 'M' + +Those =ANY constructs are not currently optimizable at all. You might +get better results with "IT.ITIRNUM IN (1000, 2000)" etc. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jul 5 13:15:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DB2C752808 + for ; + Tue, 5 Jul 2005 13:15:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28549-09 + for ; + Tue, 5 Jul 2005 16:15:05 +0000 (GMT) +Received: from jupiter.egsgroup.com (jupiter.egsgroup.com [217.199.182.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 495B252828 + for ; + Tue, 5 Jul 2005 13:15:02 -0300 (ADT) +Received: by jupiter.egsgroup.com (Postfix, from userid 65) + id A230F178D3; Tue, 5 Jul 2005 17:15:00 +0100 (BST) +X-Scanned-By: AMaViS-ng at egsgroup.com +Received: from [10.20.0.81] (unknown [217.150.127.117]) + by jupiter.egsgroup.com (Postfix) with ESMTP + id AA48D1789A; Tue, 5 Jul 2005 17:14:58 +0100 (BST) +Message-ID: <42CAB1B6.50201@egsgroup.com> +Date: Tue, 05 Jul 2005 17:13:42 +0100 +From: Alexander Stanier +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Heavy virtual memory usage on production system +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/39 +X-Sequence-Number: 13280 + +We are having terrible performance issues with a production instance of +PostgreSQL version 7.4.5, but are struggling with which parameters in +the postgresql.conf to change. + +Our database server is an Apple G5 (2 x 2GHz CPU, 2GB RAM). The +operating system is Mac OS X 10.3. + +The database seems to fine to start with, but then as the load increases +it seems to reach a threshold where the number of non-idle queries in +pg_stat_activity grows heavily and we appear to get something similar to +a motorway tail back with up to perhaps 140 queries awaiting processing. +At the same time the virtual memory usage (reported by the OS) appears +to grow heavily too (sometimes up to 50GB). The CPUs do not seems to be +working overly hard nor do the disks and the memory monitor reports +about 600MB of inactive memory. Once in this situation, the database +never catches up with itself and the only way to put it back on an even +keel is to stop the application and restart database. + +The system memory settings are: + +kern.sysv.shmmax: 536870912 +kern.sysv.shmmin: 1 +kern.sysv.shmmni: 4096 +kern.sysv.shmseg: 4096 +kern.sysv.shmall: 131072 + +We have unlimited the number of processes and open files for the user +running PostgreSQL (therefore max 2048 processes and max 12288 open files). + +Non default postgresql parameters are: + +tcpip_socket = true +max_connections = 500 +unix_socket_directory = '/Local/PostgreSQL' +shared_buffers = 8192 # min 16, at least max_connections*2, +8KB each +sort_mem = 2048 # min 64, size in KB +wal_buffers = 32 # min 4, 8KB each +effective_cache_size = 100000 # typically 8KB each +random_page_cost = 2 # units are one sequential page fetch cost +log_min_error_statement = info # Values in order of increasing severity: +log_duration = true +log_pid = true +log_statement = true +log_timestamp = true +stats_command_string = true + +although on the last restart I changed the following (since the current +config clearly isn't working): + +shared_buffers = 16384 # min 16, at least max_connections*2, +8KB each +effective_cache_size = 10000 # typically 8KB each + +We don't know whether these have helped yet - but we should get a good +idea around 10am tomorrow morning. + +We currently have the application limited to a maximum of 40 concurrent +connections to the database. + +Our application produces a fairly varied mix of queries, some quite +complex and plenty of them. We seem to average about 400,000 queries per +hour. At first I thought it might be one or two inefficient queries +blocking the CPUs but the CPUs don't seem to be very stretched. My guess +is that we have our postgresql memory settings wrong, however, the is +lots of conflicting advice about what to set (from 1000 to 100000 shared +buffers). + +Does this heavy use of VM and query tail back indicate which memory +settings are wrong? Presumably if there are 140 queries in +pg_stat_activity then postgresql will be trying to service all these +queries at once? I also presume that if VM usage is high then we are +paging a vast amount to disk. But I am not sure why. + +Has anyone seen this behaviour before and can anyone point me in the +right direction? + +Regards, + +Alexander Stanier + + +From pgsql-performance-owner@postgresql.org Tue Jul 5 13:55:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AE77B5286E + for ; + Tue, 5 Jul 2005 13:55:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39778-01 + for ; + Tue, 5 Jul 2005 16:55:21 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1CC935281B + for ; + Tue, 5 Jul 2005 13:55:17 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j65GtGNS023890; + Tue, 5 Jul 2005 12:55:16 -0400 (EDT) +To: Alexander Stanier +Cc: pgsql-performance@postgresql.org +Subject: Re: Heavy virtual memory usage on production system +In-reply-to: <42CAB1B6.50201@egsgroup.com> +References: <42CAB1B6.50201@egsgroup.com> +Comments: In-reply-to Alexander Stanier + message dated "Tue, 05 Jul 2005 17:13:42 +0100" +Date: Tue, 05 Jul 2005 12:55:16 -0400 +Message-ID: <23889.1120582516@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/40 +X-Sequence-Number: 13281 + +Alexander Stanier writes: +> The database seems to fine to start with, but then as the load increases +> it seems to reach a threshold where the number of non-idle queries in +> pg_stat_activity grows heavily and we appear to get something similar to +> a motorway tail back with up to perhaps 140 queries awaiting processing. +> At the same time the virtual memory usage (reported by the OS) appears +> to grow heavily too (sometimes up to 50GB). The CPUs do not seems to be +> working overly hard nor do the disks and the memory monitor reports +> about 600MB of inactive memory. + +You shouldn't be putting a lot of credence in the virtual memory usage +then, methinks. Some versions of top count the Postgres shared memory +against *each* backend process, leading to a wildly inflated figure for +total memory used. I'd suggest watching the output of "vmstat 1" (or +local equivalent) to observe whether there's any significant amount of +swapping going on; if not, excessive memory usage isn't the problem. + +Are you sure that the problem isn't at the level of some query taking an +exclusive lock and then sitting on it? I would expect either CPU or +disk bandwidth or both to be saturated if you were having a conventional +resource limitation problem. Again, comparing vmstat readings during +normal and slow response conditions would be instructive. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jul 5 14:49:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D9175281B + for ; + Tue, 5 Jul 2005 14:49:41 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51716-02 + for ; + Tue, 5 Jul 2005 17:49:30 +0000 (GMT) +Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) + by svr1.postgresql.org (Postfix) with ESMTP id BFB7752814 + for ; + Tue, 5 Jul 2005 14:49:23 -0300 (ADT) +Received: from [192.168.1.101] ([24.202.23.128]) by + VL-MO-MR007.ip.videotron.ca + (iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003)) + with ESMTP id <0IJ600A931G2MU@VL-MO-MR007.ip.videotron.ca> for + pgsql-performance@postgresql.org; Tue, 05 Jul 2005 13:48:02 -0400 (EDT) +Date: Tue, 05 Jul 2005 13:53:59 -0400 +From: David Gagnon +Subject: Re: Why the planner is not using the INDEX . +In-reply-to: <23492.1120579796@sss.pgh.pa.us> +To: Tom Lane +Cc: pgsql-performance@postgresql.org +Message-id: <42CAC937.4080702@siunik.com> +MIME-version: 1.0 +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7BIT +X-Accept-Language: en-us, en +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +References: <20050630222451.GA17628@calvin.surfutopia.net> + <42C473BA.9090305@commandprompt.com> + <20050630235821.GA2163@calvin.surfutopia.net> + <42C994BD.3000909@siunik.com> <23492.1120579796@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.126 tagged_above=0 required=5 tests=AWL, + UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200507/41 +X-Sequence-Number: 13282 + +Tom Lane wrote: + +>David Gagnon writes: +> +> +>> explain analyse SELECT IRNUM FROM IR +>> INNER JOIN IT ON IT.ITIRNUM = ANY ('{1000, 2000}') AND +>>IT.ITYPNUM = 'M' AND IR.IRYPNUM = IT.ITYPNUM AND IR.IRNUM = IT.ITIRNUM +>> WHERE IRNUM = ANY ('{1000, 2000}') and IRYPNUM = 'M' +>> +>> +> +>Those =ANY constructs are not currently optimizable at all. You might +>get better results with "IT.ITIRNUM IN (1000, 2000)" etc. +> +> regards, tom lane +> +> +> +I already tried this construct. But the statement comes from a stored +procedure where the {1000, 2000} is an array variable (requestIds). I +tried to use + +IT.ITIRNUM IN (requestIds) or several other variant without success. + +Is there a way to make it work? Here is the statement the statement from the store procedure. Remenber requestIds is an array of int. + + +FOR inventoryTransaction IN + SELECT DISTINCT IRNUM, IRAENUM, IRSTATUT, IRSENS, IRSOURCE, +IRDATE, IRQTE + FROM IR + WHERE IRNUM = ANY (requestIds) and IRYPNUM = companyId + LOOP + +Thank for your help !!!! +/David + +From pgsql-performance-owner@postgresql.org Tue Jul 5 18:31:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3EFDC52823 + for ; + Tue, 5 Jul 2005 18:31:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 05167-06 + for ; + Tue, 5 Jul 2005 21:31:14 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id C99FD52824 + for ; + Tue, 5 Jul 2005 18:31:13 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7574036; Tue, 05 Jul 2005 14:33:24 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: emil@baymountain.com +Subject: Re: Planner constants for RAM resident databases +Date: Tue, 5 Jul 2005 14:33:28 -0700 +User-Agent: KMail/1.8 +Cc: John A Meinel , + Postgresql Performance +References: <200507012159.39041.emil@baymountain.com> + <42C606AA.8060406@arbash-meinel.com> + <200507020944.07339.emil@baymountain.com> +In-Reply-To: <200507020944.07339.emil@baymountain.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200507051433.28971.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/42 +X-Sequence-Number: 13283 + +Emil, + +> -> Merge Left Join (cost=9707.71..13993.52 rows=1276 width=161) +> (actual time=164.423..361.477 rows=49 loops=1) + +That would indicate that you need to either increase your statistical +sampling (SET STATISTICS) or your frequency of running ANALYZE, or both. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Jul 6 09:04:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 811F352838 + for ; + Wed, 6 Jul 2005 09:04:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68134-03 + for ; + Wed, 6 Jul 2005 12:04:48 +0000 (GMT) +Received: from jupiter.egsgroup.com (jupiter.egsgroup.com [217.199.182.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 1975F52808 + for ; + Wed, 6 Jul 2005 09:04:47 -0300 (ADT) +Received: by jupiter.egsgroup.com (Postfix, from userid 65) + id AC90F1784D; Wed, 6 Jul 2005 13:04:49 +0100 (BST) +X-Scanned-By: AMaViS-ng at egsgroup.com +Received: from [10.20.0.81] (unknown [217.150.127.117]) + by jupiter.egsgroup.com (Postfix) with ESMTP + id 8E2ED643B; Wed, 6 Jul 2005 13:04:47 +0100 (BST) +Message-ID: <42CBC8A0.4070901@egsgroup.com> +Date: Wed, 06 Jul 2005 13:03:44 +0100 +From: Alexander Stanier +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: pgsql-performance@postgresql.org +Subject: Re: Heavy virtual memory usage on production system +References: <42CAB1B6.50201@egsgroup.com> <23889.1120582516@sss.pgh.pa.us> +In-Reply-To: <23889.1120582516@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/43 +X-Sequence-Number: 13284 + +The problem happened again this morning and I took the chance to check +out the locking situation. The number of locks increased dramatically up +to over 1000, but they were all "AccessShareLocks" and all were granted. +The odd "RowExclusiveLock" appeared but none persisted. On the basis +that nothing seems to be waiting for a lock, I don't think it is a +locking problem. I think the vast number of locks is symptom of the fact +that the server is trying to service a vast number of requests. +Eventually, the server seemed to catch up with itself - the CPU went up, +the VM went down and the number of queries in pg_stat_activity reduced. + +The problem then occurred a second time and there seemed to be a lot of +pageouts and pageins going on, but I was only looking at top so it was +difficult to tell. I have now restarted with a statement_timeout of 2 +mins to protect the server from poorly performing queries (fairly brutal +- but it does at least stop the downward spiral). I have also reduced +the sort_mem to 1024. I guess it could be that we simply need more +memory in the server. + +I have got vmstat (vm_stat on Mac) running and I will watch the +behaviour...... + +Regards, Alex Stanier. + +Tom Lane wrote: + +>Alexander Stanier writes: +> +> +>>The database seems to fine to start with, but then as the load increases +>>it seems to reach a threshold where the number of non-idle queries in +>>pg_stat_activity grows heavily and we appear to get something similar to +>>a motorway tail back with up to perhaps 140 queries awaiting processing. +>>At the same time the virtual memory usage (reported by the OS) appears +>>to grow heavily too (sometimes up to 50GB). The CPUs do not seems to be +>>working overly hard nor do the disks and the memory monitor reports +>>about 600MB of inactive memory. +>> +>> +> +>You shouldn't be putting a lot of credence in the virtual memory usage +>then, methinks. Some versions of top count the Postgres shared memory +>against *each* backend process, leading to a wildly inflated figure for +>total memory used. I'd suggest watching the output of "vmstat 1" (or +>local equivalent) to observe whether there's any significant amount of +>swapping going on; if not, excessive memory usage isn't the problem. +> +>Are you sure that the problem isn't at the level of some query taking an +>exclusive lock and then sitting on it? I would expect either CPU or +>disk bandwidth or both to be saturated if you were having a conventional +>resource limitation problem. Again, comparing vmstat readings during +>normal and slow response conditions would be instructive. +> +> regards, tom lane +> +> +> + +From pgsql-performance-owner@postgresql.org Wed Jul 6 11:15:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6A1F152809 + for ; + Wed, 6 Jul 2005 11:15:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89436-06 + for ; + Wed, 6 Jul 2005 14:15:34 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E8B2B5280B + for ; + Wed, 6 Jul 2005 11:15:32 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j66EFXjV025887; + Wed, 6 Jul 2005 10:15:33 -0400 (EDT) +To: Alexander Stanier +Cc: pgsql-performance@postgresql.org +Subject: Re: Heavy virtual memory usage on production system +In-reply-to: <42CBC8A0.4070901@egsgroup.com> +References: <42CAB1B6.50201@egsgroup.com> <23889.1120582516@sss.pgh.pa.us> + <42CBC8A0.4070901@egsgroup.com> +Comments: In-reply-to Alexander Stanier + message dated "Wed, 06 Jul 2005 13:03:44 +0100" +Date: Wed, 06 Jul 2005 10:15:33 -0400 +Message-ID: <25886.1120659333@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/44 +X-Sequence-Number: 13285 + +Alexander Stanier writes: +> The problem happened again this morning and I took the chance to check +> out the locking situation. The number of locks increased dramatically up +> to over 1000, but they were all "AccessShareLocks" and all were granted. +> The odd "RowExclusiveLock" appeared but none persisted. On the basis +> that nothing seems to be waiting for a lock, I don't think it is a +> locking problem. + +Hmm. How many active processes were there, and how many locks per +process? (A quick "SELECT pid, count(*) GROUP BY pid" query should give +you this info next time.) We just recently got rid of some O(N^2) +behavior in the lock manager for cases where a single backend holds many +different locks. So if there's a single query acquiring a whole lot of +locks, that could possibly have something to do with this. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jul 6 11:50:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D6F1D52993 + for ; + Wed, 6 Jul 2005 11:50:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95153-07 + for ; + Wed, 6 Jul 2005 14:50:42 +0000 (GMT) +Received: from jupiter.egsgroup.com (jupiter.egsgroup.com [217.199.182.198]) + by svr1.postgresql.org (Postfix) with ESMTP id D2CAD52968 + for ; + Wed, 6 Jul 2005 11:50:40 -0300 (ADT) +Received: by jupiter.egsgroup.com (Postfix, from userid 65) + id 5F08E178CC; Wed, 6 Jul 2005 15:50:45 +0100 (BST) +X-Scanned-By: AMaViS-ng at egsgroup.com +Received: from [10.20.0.81] (unknown [217.150.127.117]) + by jupiter.egsgroup.com (Postfix) with ESMTP + id 6B795177BD; Wed, 6 Jul 2005 15:50:43 +0100 (BST) +Message-ID: <42CBEF84.8080007@egsgroup.com> +Date: Wed, 06 Jul 2005 15:49:40 +0100 +From: Alexander Stanier +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: pgsql-performance@postgresql.org +Subject: Re: Heavy virtual memory usage on production system +References: <42CAB1B6.50201@egsgroup.com> <23889.1120582516@sss.pgh.pa.us> + <42CBC8A0.4070901@egsgroup.com> <25886.1120659333@sss.pgh.pa.us> +In-Reply-To: <25886.1120659333@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/45 +X-Sequence-Number: 13286 + +Looks as though there are several processes which are acquiring a load +of locks: + +pid | count +------+------- + 3193 | 2 + 3192 | 9 + 3191 | 7 + 3190 | 3 + 3189 | 2 + 3188 | 3 + 3187 | 3 + 3186 | 3 + 3185 | 3 + 3184 | 3 + 3183 | 3 + 3182 | 13 + 3181 | 3 + 3179 | 10 + 3175 | 13 + 3174 | 2 + 3173 | 10 + 2917 | 3 + 3153 | 8 + 3150 | 8 + 3149 | 8 + 3146 | 9 + 3145 | 8 + 3144 | 8 + 3143 | 9 + 3142 | 3 + 3141 | 10 + 3127 | 8 + 3125 | 13 + 3124 | 13 + 3121 | 8 + 3118 | 8 + 3114 | 8 + 3113 | 8 + 3110 | 8 + 3106 | 8 + 3104 | 9 + 3102 | 8 + 3100 | 13 + 2314 | 2 +(40 rows) + +I guess it might be worth us getting this server up to PostgreSQL 8.0.3. +At least we can then discount that as a problem. + +Regards, Alex Stanier. + +Tom Lane wrote: + +>Alexander Stanier writes: +> +> +>>The problem happened again this morning and I took the chance to check +>>out the locking situation. The number of locks increased dramatically up +>>to over 1000, but they were all "AccessShareLocks" and all were granted. +>>The odd "RowExclusiveLock" appeared but none persisted. On the basis +>>that nothing seems to be waiting for a lock, I don't think it is a +>>locking problem. +>> +>> +> +>Hmm. How many active processes were there, and how many locks per +>process? (A quick "SELECT pid, count(*) GROUP BY pid" query should give +>you this info next time.) We just recently got rid of some O(N^2) +>behavior in the lock manager for cases where a single backend holds many +>different locks. So if there's a single query acquiring a whole lot of +>locks, that could possibly have something to do with this. +> +> regards, tom lane +> +> +> + +From pgsql-performance-owner@postgresql.org Wed Jul 6 12:06:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EFD2452987 + for ; + Wed, 6 Jul 2005 12:06:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95867-10 + for ; + Wed, 6 Jul 2005 15:06:05 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9818752984 + for ; + Wed, 6 Jul 2005 12:06:04 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j66F628w026527; + Wed, 6 Jul 2005 11:06:02 -0400 (EDT) +To: Alexander Stanier +Cc: pgsql-performance@postgresql.org +Subject: Re: Heavy virtual memory usage on production system +In-reply-to: <42CBEF84.8080007@egsgroup.com> +References: <42CAB1B6.50201@egsgroup.com> <23889.1120582516@sss.pgh.pa.us> + <42CBC8A0.4070901@egsgroup.com> <25886.1120659333@sss.pgh.pa.us> + <42CBEF84.8080007@egsgroup.com> +Comments: In-reply-to Alexander Stanier + message dated "Wed, 06 Jul 2005 15:49:40 +0100" +Date: Wed, 06 Jul 2005 11:06:02 -0400 +Message-ID: <26526.1120662362@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/46 +X-Sequence-Number: 13287 + +Alexander Stanier writes: +> Looks as though there are several processes which are acquiring a load +> of locks: + +13 locks isn't "a load". I was worried about scenarios in which a +single process might take hundreds or thousands of locks; it doesn't +look like you have that. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jul 6 14:15:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 817D2528B9 + for ; + Wed, 6 Jul 2005 14:15:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30927-10 + for ; + Wed, 6 Jul 2005 17:15:49 +0000 (GMT) +Received: from lon-mail-1.gradwell.net (lon-mail-1.gradwell.net + [193.111.201.125]) + by svr1.postgresql.org (Postfix) with ESMTP id DC1935289B + for ; + Wed, 6 Jul 2005 14:15:47 -0300 (ADT) +Received: from www.gradwell.com ([193.111.200.100]) + by lon-mail-1.gradwell.net with smtp (Gradwell gwh-smtpd 1.186) id + 42cc11c3.f44.c7; Wed, 6 Jul 2005 18:15:47 +0100 + (envelope-sender ) +Received: from 217.45.209.171 + (SquirrelMail authenticated user paul@pop3.oxton.com) + by www.gradwell.com with HTTP; Wed, 6 Jul 2005 18:15:47 +0100 (BST) +Message-ID: <3688.217.45.209.171.1120670147.squirrel@www.gradwell.com> +Date: Wed, 6 Jul 2005 18:15:47 +0100 (BST) +Subject: Data Warehousing Tuning +From: "Paul Johnson" +To: pgsql-performance@postgresql.org +Reply-To: paul@oxton.com +User-Agent: SquirrelMail/1.4.2 +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Priority: 3 +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200507/47 +X-Sequence-Number: 13288 + +Hi all, we have the following setup: + +- Sun V250 server +- 2*1.3GHz Sparc IIIi CPU +- 8GB RAM +- 8*73GB SCSI drives +- Solaris 10 +- Postgres 8 + +Disks 0 and 1 are mirrored and contain the OS and the various software +packages, disks 2-7 are configured as a 320GB concatenation mounted on +/data, which is where load files and Postgres database and log files live. + +The box is used by a small number of developers doing solely +Postgres-based data warehousing work. There are no end-users on the box, +and we are aiming for the maximum IO throughput. + +Questions are as follows: + +1) Should we have set the page size to 32MB when we compiled Postgres? + +We mainly do bulk loads using 'copy', full-table scans and large joins so +this would seem sensible. Tables are typically 10 million rows at present. + +2) What are the obvious changes to make to postgresql.conf? + +Things like shared_buffers, work_mem, maintenance_work_mem and +checkpoint_segments seem like good candidates given our data warehousing +workloads. + +3) Ditto /etc/system? + +4) We moved the pg_xlog files off /data/postgres (disks 2-7) and into +/opt/pg_xlog (disks 0-1), but it seemed like performance decreased, so we +moved them back again. + +Has anyone experienced real performance gains by moving the pg_xlog files? + +Thanks in anticipation, + +Paul. + + + +From pgsql-performance-owner@postgresql.org Wed Jul 6 14:58:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 33995528A6 + for ; + Wed, 6 Jul 2005 14:58:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 41475-08 + for ; + Wed, 6 Jul 2005 17:58:42 +0000 (GMT) +Received: from pelego.atua.com.br (unknown [200.248.138.60]) + by svr1.postgresql.org (Postfix) with ESMTP id A021952886 + for ; + Wed, 6 Jul 2005 14:58:41 -0300 (ADT) +Received: from [10.0.0.171] (unknown [10.0.0.171]) + by pelego.atua.com.br (Postfix) with ESMTP id 71D9313F79F + for ; + Wed, 6 Jul 2005 14:58:31 -0300 (BRT) +Message-ID: <42CC1BC7.7060902@atua.com.br> +Date: Wed, 06 Jul 2005 14:58:31 -0300 +From: Alvaro Nunes Melo +User-Agent: Debian Thunderbird 1.0 (X11/20050116) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: PostgreSQL - Performance +Subject: Storing data and indexes in different disks +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.032 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/48 +X-Sequence-Number: 13289 + +Hi, + +I'm about to recommend a server model to a client, and I've read a in +many places (including in this list) that storing indexes in one disk +and the rest of the database in other disk might increase the overall +performance of the system in about 10%. + +Making this only by a symbolic link is enough, or there are any futher +steps? We were thinking (for costs reasons) in use only 2 SCSI disks, +without any level of RAID. Is this enough to achieve performance +improvement mentioned above? + +Best regards, +Alvaro + +From pgsql-performance-owner@postgresql.org Wed Jul 6 15:44:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2CD2C5293D + for ; + Wed, 6 Jul 2005 15:44:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51344-03 + for ; + Wed, 6 Jul 2005 18:44:22 +0000 (GMT) +Received: from mail.aveo.aveopharma.com (67.109.105.227.ptr.us.xo.net + [67.109.105.227]) + by svr1.postgresql.org (Postfix) with SMTP id D28C4528E7 + for ; + Wed, 6 Jul 2005 15:44:21 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Storing data and indexes in different disks +Date: Wed, 6 Jul 2005 14:46:03 -0400 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Storing data and indexes in different disks +Thread-Index: AcWCVSB8qsP2PWPnToacjdApsfHK5gAA/3TA +From: "Dmitri Bichko" +To: "Alvaro Nunes Melo" , + "PostgreSQL - Performance" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.064 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/49 +X-Sequence-Number: 13290 + +I'd say it's a little early to worry about a 10% performance increase +when you don't have any redundancy. You might want to consider using +more, cheaper SATA disks - with more spindles you may very well get +better performance in addition to redundancy. + +Anyway, here's an optimization project I just went through recently: the +old database was running all on a SAN attached RAID5 partition; moved +the indices to a local striped mirror set (faster disks too: 15K rpm), +moved the WAL files to a separate local two disk mirror, and spent a lot +of time tuning the config parameters (the old install was running the +conservative defaults). All the hardware (apart from the additional +disks) is the same. For some simple queries I saw as much as a 150X +speedup, though that's certainly not typical of the performance +improvement overall. Most of this is likely due to the memory settings, +but faster disks certainly play a part. + +In any case, it's hard to say what would improve performance for you +without knowing what kind of applications you are running and what sort +of load they see. + +Dmitri + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Alvaro +Nunes Melo +Sent: Wednesday, July 06, 2005 1:59 PM +To: PostgreSQL - Performance +Subject: [PERFORM] Storing data and indexes in different disks + + +Hi, + +I'm about to recommend a server model to a client, and I've read a in=20 +many places (including in this list) that storing indexes in one disk=20= + +and the rest of the database in other disk might increase the overall=20 +performance of the system in about 10%. + +Making this only by a symbolic link is enough, or there are any futher=20= + +steps? We were thinking (for costs reasons) in use only 2 SCSI disks,=20 +without any level of RAID. Is this enough to achieve performance=20 +improvement mentioned above? + +Best regards, +Alvaro + +---------------------------(end of broadcast)--------------------------- +TIP 7: don't forget to increase your free space map settings +The information transmitted is intended only for the person or entity to = +which it is addressed and may contain confidential and/or privileged mate= +rial. Any review, retransmission, dissemination or other use of, or takin= +g of any action in reliance upon, this information by persons or entities= + other than the intended recipient is prohibited. If you received this in= + error, please contact the sender and delete the material from any comput= +er + +From pgsql-performance-owner@postgresql.org Wed Jul 6 16:49:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 302F6529A0 + for ; + Wed, 6 Jul 2005 16:49:36 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65543-01 + for ; + Wed, 6 Jul 2005 19:49:34 +0000 (GMT) +Received: from netbox.unitech.com.ar (unknown [200.32.92.34]) + by svr1.postgresql.org (Postfix) with ESMTP id C2B485299F + for ; + Wed, 6 Jul 2005 16:49:28 -0300 (ADT) +Received: from dariop (dariop.unitech.com.ar [192.168.1.237]) + by netbox.unitech.com.ar (8.11.6/8.11.6) with ESMTP id j66Kp0E27518 + for ; Wed, 6 Jul 2005 16:51:00 -0400 +Received: from 127.0.0.1 (AVG SMTP 7.0.323 [267.8.9]); + Wed, 06 Jul 2005 16:49:21 -0300 +From: "Dario" +To: +Subject: ALTER TABLE tabla ALTER COLUMN columna SET STATISTICS number +Date: Wed, 6 Jul 2005 16:49:21 -0300 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 8bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.174 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/50 +X-Sequence-Number: 13291 + +�where is stored the value set by ALTER TABLE table_name ALTER COLUMN +column_name SET STATISTICS = [1-1000]? +I've set this to 1000, and I didn't remember in which column (doh!). Is +there any table to look? (I did 'grep "set stat" $PGDATA/pg_log/*' and found +it, but may be there is a better way) + +I couldn't find it in the docs neithr "googling" + + +Greetings +-------------------------------------- +Long life, little spam and prosperity + + +From pgsql-performance-owner@postgresql.org Wed Jul 6 17:08:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DA717529BA + for ; + Wed, 6 Jul 2005 17:08:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70229-02 + for ; + Wed, 6 Jul 2005 20:07:56 +0000 (GMT) +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by svr1.postgresql.org (Postfix) with ESMTP id A6564529B5 + for ; + Wed, 6 Jul 2005 17:07:54 -0300 (ADT) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j66K7rA7096698 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Wed, 6 Jul 2005 14:07:55 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j66K7q1p067069; + Wed, 6 Jul 2005 14:07:52 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j66K7qg1067060; + Wed, 6 Jul 2005 14:07:52 -0600 (MDT) (envelope-from mfuhr) +Date: Wed, 6 Jul 2005 14:07:52 -0600 +From: Michael Fuhr +To: Dario +Cc: pgsql-performance@postgresql.org +Subject: Re: ALTER TABLE tabla ALTER COLUMN columna SET STATISTICS number +Message-ID: <20050706200752.GA33295@winnie.fuhr.org> +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.109 tagged_above=0 required=5 tests=AWL, + UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200507/51 +X-Sequence-Number: 13292 + +On Wed, Jul 06, 2005 at 04:49:21PM -0300, Dario wrote: +> where is stored the value set by ALTER TABLE table_name ALTER COLUMN +> column_name SET STATISTICS = [1-1000]? + +pg_attribute.attstattarget + +Example query: + +SELECT attrelid::regclass, attname, attstattarget +FROM pg_attribute +WHERE attstattarget > 0; + +See the "System Catalogs" chapter in the documentation for more +information. + +-- +Michael Fuhr +http://www.fuhr.org/~mfuhr/ + +From pgsql-performance-owner@postgresql.org Wed Jul 6 18:19:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9EB88529A4 + for ; + Wed, 6 Jul 2005 18:19:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 82655-04 + for ; + Wed, 6 Jul 2005 21:19:49 +0000 (GMT) +Received: from dns.texnet.it (dns.texnet.it [217.19.150.6]) + by svr1.postgresql.org (Postfix) with ESMTP id BD3B452998 + for ; + Wed, 6 Jul 2005 18:19:47 -0300 (ADT) +Received: from pool-a-150.texnet.it ([217.19.150.150] helo=paros.rigacci.org) + by dns.texnet.it with esmtp (Exim 3.35 #1 (Debian)) + id 1DqHJ4-000541-00 + for ; Wed, 06 Jul 2005 23:19:47 +0200 +Received: from niccolo by paros.rigacci.org with local (Exim 4.50) + id 1DqHJ4-0000tt-8b + for pgsql-performance@postgresql.org; Wed, 06 Jul 2005 23:19:46 +0200 +Date: Wed, 6 Jul 2005 23:19:46 +0200 +To: pgsql-performance@postgresql.org +Subject: CURSOR slowes down a WHERE clause 100 times? +Message-ID: <20050706211946.GA3460@rigacci.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.5.9i +From: Niccolo Rigacci +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/52 +X-Sequence-Number: 13293 + +Hi to all, + +I have a performace problem with the following query: + + BEGIN; + DECLARE mycursor BINARY CURSOR FOR + SELECT + toponimo, + wpt + FROM wpt_comuni_view + WHERE ( + wpt && + setSRID('BOX3D(4.83 36, 20.16 47.5)'::BOX3D, 4326) + ); + FETCH ALL IN mycursor; + END; + +I get the results in about 108 seconds (8060 rows). + +If I issue the SELECT alone (without the CURSOR) I get the +same results in less than 1 second. + +The wpt_comuni_view is a VIEW of a 3 tables JOIN, and the "wpt" +field is a PostGIS geometry column. The "&&" is the PostGIS +"overlaps" operator. + +If I CURSOR SELECT from a temp table instead of the JOIN VIEW the +query time 1 second. + +If I omit the WHERE clause the CURSOR fetches results in 1 +second. + +Can the CURSOR on JOIN affects so heavly the WHERE clause? I +suspect that - with the CURSOR - a sequential scan is performed +on the entire data set for each fetched record... + +Any idea? + +This is the definition of the VIEW: + + CREATE VIEW wpt_comuni_view AS + SELECT istat_wpt.oid, istat_wpt.id, istat_wpt.toponimo, + istat_comuni.residenti, istat_wpt.wpt + FROM istat_comuni + JOIN istat_comuni2wpt + USING (idprovincia, idcomune) + JOIN istat_wpt + ON (idwpt = id); + +Thank you for any hint. + +-- +Niccolo Rigacci +Firenze - Italy + +War against Iraq? Not in my name! + +From pgsql-performance-owner@postgresql.org Wed Jul 6 18:29:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 096DD5284F + for ; + Wed, 6 Jul 2005 18:29:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87165-02 + for ; + Wed, 6 Jul 2005 21:29:35 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id 8245E5285C + for ; + Wed, 6 Jul 2005 18:29:34 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050706212920m920060ieqe>; Wed, 6 Jul 2005 21:29:35 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 286DF56086; Wed, 6 Jul 2005 16:29:19 -0500 (CDT) +Received: from [129.255.168.114] (host168-114.uihc.uiowa.edu + [129.255.168.114]) + by juju.arbash-meinel.com (Postfix) with ESMTP id E62835607F; + Wed, 6 Jul 2005 16:29:07 -0500 (CDT) +Message-ID: <42CC4D1C.9040606@arbash-meinel.com> +Date: Wed, 06 Jul 2005 16:29:00 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Niccolo Rigacci , + Postgresql Performance +Subject: Re: CURSOR slowes down a WHERE clause 100 times? +References: <20050706211946.GA3460@rigacci.org> +In-Reply-To: <20050706211946.GA3460@rigacci.org> +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig0BDC10F2B83E07547A560931" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/53 +X-Sequence-Number: 13294 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig0BDC10F2B83E07547A560931 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Niccolo Rigacci wrote: + +>Hi to all, +> +>I have a performace problem with the following query: +> +> BEGIN; +> DECLARE mycursor BINARY CURSOR FOR +> SELECT +> toponimo, +> wpt +> FROM wpt_comuni_view +> WHERE ( +> wpt && +> setSRID('BOX3D(4.83 36, 20.16 47.5)'::BOX3D, 4326) +> ); +> FETCH ALL IN mycursor; +> END; +> +>I get the results in about 108 seconds (8060 rows). +> +>If I issue the SELECT alone (without the CURSOR) I get the +>same results in less than 1 second. +> +>The wpt_comuni_view is a VIEW of a 3 tables JOIN, and the "wpt" +>field is a PostGIS geometry column. The "&&" is the PostGIS +>"overlaps" operator. +> +>If I CURSOR SELECT from a temp table instead of the JOIN VIEW the +>query time 1 second. +> +>If I omit the WHERE clause the CURSOR fetches results in 1 +>second. +> +>Can the CURSOR on JOIN affects so heavly the WHERE clause? I +>suspect that - with the CURSOR - a sequential scan is performed +>on the entire data set for each fetched record... +> +>Any idea? +> +> +What does it say if you do "EXPLAIN ANALYZE SELECT..." both with and +without the cursor? +It may not say much for the cursor, but I think you can explain analyze +the fetch statements. + +It is my understanding that Cursors generally favor using an +slow-startup style plan, which usually means using an index, because it +expects that you won't actually want all of the data. A seqscan is not +always slower, especially if you need to go through most of the data. + +Without an explain analyze it's hard to say what the planner is thinking +and doing. + +>This is the definition of the VIEW: +> +> CREATE VIEW wpt_comuni_view AS +> SELECT istat_wpt.oid, istat_wpt.id, istat_wpt.toponimo, +> istat_comuni.residenti, istat_wpt.wpt +> FROM istat_comuni +> JOIN istat_comuni2wpt +> USING (idprovincia, idcomune) +> JOIN istat_wpt +> ON (idwpt = id); +> +>Thank you for any hint. +> +> +> +You might also try comparing your CURSOR to a prepared statement. There +are a few rare cases where preparing is worse than issuing the query +directly, depending on your data layout. + +John +=:-> + + + +--------------enig0BDC10F2B83E07547A560931 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFCzE0fJdeBCYSNAAMRAk+eAJ96Sz+yQMX94j1ba77ojk021iA6IQCfYRvm +ynbwpZw6yU9j96fu225RJvA= +=DWez +-----END PGP SIGNATURE----- + +--------------enig0BDC10F2B83E07547A560931-- + +From pgsql-performance-owner@postgresql.org Mon Jul 11 20:28:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 664EA529A3 + for ; + Wed, 6 Jul 2005 18:54:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91316-01 + for ; + Wed, 6 Jul 2005 21:54:11 +0000 (GMT) +Received: from netbox.unitech.com.ar (unknown [200.32.92.34]) + by svr1.postgresql.org (Postfix) with ESMTP id F1E1752995 + for ; + Wed, 6 Jul 2005 18:54:07 -0300 (ADT) +Received: from dariop (dariop.unitech.com.ar [192.168.1.237]) + by netbox.unitech.com.ar (8.11.6/8.11.6) with ESMTP id j66MtfE28801 + for ; Wed, 6 Jul 2005 18:55:41 -0400 +Received: from 127.0.0.1 (AVG SMTP 7.0.323 [267.8.9]); + Wed, 06 Jul 2005 18:54:02 -0300 +From: "Dario Pudlo" +To: +Subject: join and query planner +Date: Wed, 6 Jul 2005 18:54:02 -0300 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 +In-Reply-To: +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/111 +X-Sequence-Number: 13352 + +(first at all, sorry for my english) +Hi. + - Does "left join" restrict the order in which the planner must join +tables? I've read about join, but i'm not sure about left join... + - If so: Can I avoid this behavior? I mean, make the planner resolve the +query, using statistics (uniqueness, data distribution) rather than join +order. + + My query looks like: + SELECT ... + FROM a, b, + LEFT JOIN c ON (c.key = a.key) + LEFT JOIN d on (d.key=a.key) + WHERE (a.key = b.key) AND (b.column <= 100) + + b.column has a lot better selectivity, but planner insist on resolve +first c.key = a.key. + + Of course, I could rewrite something like: + SELECT ... + FROM + (SELECT ... + FROM a,b + LEFT JOIN d on (d.key=a.key) + WHERE (b.column <= 100) + ) + as aa + LEFT JOIN c ON (c.key = aa.key) + + but this is query is constructed by an application with a "multicolumn" +filter. It's dynamic. + It means that a user could choose to look for "c.column = 1000". And +also, combinations of filters. + + So, I need the planner to choose the best plan... + +I've already change statistics, I clustered tables with cluster, ran vacuum +analyze, changed work_mem, shared_buffers... + +Greetings. TIA. + + +From pgsql-performance-owner@postgresql.org Wed Jul 6 19:05:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BBEFD529A2 + for ; + Wed, 6 Jul 2005 19:05:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91573-05 + for ; + Wed, 6 Jul 2005 22:04:53 +0000 (GMT) +Received: from netbox.unitech.com.ar (unknown [200.32.92.34]) + by svr1.postgresql.org (Postfix) with ESMTP id E5B8A52995 + for ; + Wed, 6 Jul 2005 19:04:52 -0300 (ADT) +Received: from dariop (dariop.unitech.com.ar [192.168.1.237]) + by netbox.unitech.com.ar (8.11.6/8.11.6) with ESMTP id j66N6QE28869 + for ; Wed, 6 Jul 2005 19:06:26 -0400 +Received: from 127.0.0.1 (AVG SMTP 7.0.323 [267.8.9]); + Wed, 06 Jul 2005 19:04:48 -0300 +From: "Dario" +To: +Subject: join and query planner +Date: Wed, 6 Jul 2005 19:04:48 -0300 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 +In-Reply-To: +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.131 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/54 +X-Sequence-Number: 13295 + + +(first at all, sorry for my english) +Hi. + - Does "left join" restrict the order in which the planner must join +tables? I've read about join, but i'm not sure about left join... + - If so: Can I avoid this behavior? I mean, make the planner resolve the +query, using statistics (uniqueness, data distribution) rather than join +order. + + My query looks like: + SELECT ... + FROM a, b, + LEFT JOIN c ON (c.key = a.key) + LEFT JOIN d on (d.key=a.key) + WHERE (a.key = b.key) AND (b.column <= 100) + + b.column has a lot better selectivity, but planner insist on resolve +first c.key = a.key. + + Of course, I could rewrite something like: + SELECT ... + FROM + (SELECT ... + FROM a,b + LEFT JOIN d on (d.key=a.key) + WHERE (b.column <= 100) + ) + as aa + LEFT JOIN c ON (c.key = aa.key) + + but this is query is constructed by an application with a "multicolumn" +filter. It's dynamic. + It means that a user could choose to look for "c.column = 1000". And +also, combinations of filters. + + So, I need the planner to choose the best plan... + +I've already change statistics, I clustered tables with cluster, ran vacuum +analyze, changed work_mem, shared_buffers... + +Greetings. TIA. + + +From pgsql-performance-owner@postgresql.org Wed Jul 6 19:34:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 13EFC529C8 + for ; + Wed, 6 Jul 2005 19:34:08 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99288-02 + for ; + Wed, 6 Jul 2005 22:34:04 +0000 (GMT) +Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) + by svr1.postgresql.org (Postfix) with ESMTP id 940E6529C3 + for ; + Wed, 6 Jul 2005 19:34:03 -0300 (ADT) +Received: by megazone.bigpanda.com (Postfix, from userid 1001) + id 6BF3C353CD; Wed, 6 Jul 2005 15:34:03 -0700 (PDT) +Received: from localhost (localhost [127.0.0.1]) + by megazone.bigpanda.com (Postfix) with ESMTP + id 6A7DC350DB; Wed, 6 Jul 2005 15:34:03 -0700 (PDT) +Date: Wed, 6 Jul 2005 15:34:03 -0700 (PDT) +From: Stephan Szabo +To: Dario +Cc: pgsql-performance@postgresql.org +Subject: Re: join and query planner +In-Reply-To: +Message-ID: <20050706152750.V50953@megazone.bigpanda.com> +References: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/55 +X-Sequence-Number: 13296 + +On Wed, 6 Jul 2005, Dario wrote: + +> +> (first at all, sorry for my english) +> Hi. +> - Does "left join" restrict the order in which the planner must join +> tables? I've read about join, but i'm not sure about left join... + +Yes. Reordering the outer joins can change the results in some cases which +would be invalid. Before we can change the ordering behavior, we really +need to know under what conditions it is safe to do the reordering. + + +From pgsql-performance-owner@postgresql.org Wed Jul 6 21:05:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 69DCA529A1 + for ; + Wed, 6 Jul 2005 21:05:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 15887-04 + for ; + Thu, 7 Jul 2005 00:05:15 +0000 (GMT) +Received: from mail.Mi8.com (mail.mi8.com [63.240.6.41]) + by svr1.postgresql.org (Postfix) with ESMTP id AB6515299B + for ; + Wed, 6 Jul 2005 21:05:13 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- GW01 Welcome + to Mi8 Corporation www.Mi8.com); Wed, 06 Jul 2005 20:05:01 -0400 +X-Server-Uuid: F1A2E19A-84E4-48DD-8F48-B475613F58B2 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 6 Jul 2005 + 20:04:33 -0400 +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: Re: Data Warehousing Tuning +Date: Wed, 6 Jul 2005 20:02:24 -0400 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Data Warehousing Tuning +Thread-Index: AcWCToiHLbiY6PbdRHSRP/aj2gvOjQAJFodQ +From: "Frank Wosczyna" +To: paul@oxton.com, pgsql-performance@postgresql.org +X-OriginalArrivalTime: 07 Jul 2005 00:04:33.0168 (UTC) + FILETIME=[7433E100:01C58287] +X-WSS-ID: 6ED2AE2728K2388301-07-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/56 +X-Sequence-Number: 13297 + + +Hi Paul, just some quick thoughts: + +=20 +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org=20 +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 +> Paul Johnson +> Sent: Wednesday, July 06, 2005 10:16 AM +> To: pgsql-performance@postgresql.org +> Subject: [PERFORM] Data Warehousing Tuning +>=20 + +>=20 +> Questions are as follows: +>=20 +> 1) Should we have set the page size to 32MB when we compiled Postgres? +>=20 +> We mainly do bulk loads using 'copy', full-table scans and=20 +> large joins so this would seem sensible. Tables are typically=20 +> 10 million rows at present. + +I would defer changing page size to the "fine-tuning" category, our +experience with that has not produced substantial gains. Would focus on +the other categories you mention below first. + +Also, for heavy use of COPY, you may consider using the latest release +of Bizgres 0.6, which should speed loads: +http://www.bizgres.org/pages.php?pg=3Ddownloads or +http://www.greenplum.com/prod_download.html for compiled version. + + +>=20 +> 2) What are the obvious changes to make to postgresql.conf? +>=20 +> Things like shared_buffers, work_mem, maintenance_work_mem=20 +> and checkpoint_segments seem like good candidates given our=20 +> data warehousing workloads. + +You're on the right track, it depends on nature of queries (sorry for +giving you the "consulting" answer on that one), but here are some +PostgreSQL configurations to consider: + +a - Consider using separate disk partitions for transaction log, temp +space and WAL. See separate note about WAL and directio in Solaris +tuning note, link below. May put temp space on a separate partition, in +anticipation of forthcoming changes which take advantage of this. + +b - Sizing temp space? Should be as large as the largest index. Set +max speed read/write config: minimal journaling, use write-through cache +on this. + +c - Might try increasing checkpoint segments (64?). More logs produces +significant benefit. And turn checkpoint warnings on (Off by default). + +d - Sort mem and work mem - What queries are you running? Workmem used +in aggregation/sorts. How many concurrent reports? For 3 complex +queries, might try 256MB at work mem? + +e - You probably do this already, but always ANALYZE after loads. + +f - Maintenance work mem - used in vacuum, analyze, creating bulk +indexes, bulk checking for keys. Might consider using 512 or 750? + + +>=20 +> 3) Ditto /etc/system? + +See http://www.bizgres.org/bb/viewtopic.php?t=3D6 for Solaris. + + +>=20 +> 4) We moved the pg_xlog files off /data/postgres (disks 2-7)=20 +> and into /opt/pg_xlog (disks 0-1), but it seemed like=20 +> performance decreased, so we moved them back again. +>=20 +> Has anyone experienced real performance gains by moving the=20 +> pg_xlog files? +>=20 + +Likely to help only with COPY. + +Feel free to contact me directly if you have any questions on my +statements above. There is a Configurator in development which you +might find helpful when it is complete: +http://www.bizgres.org/pages.php?pg=3Ddevelopers%7Cprojects%7Cconfigurato= +r + + + +Kind Regards, +Frank + +Frank Wosczyna +Systems Engineer ++1 650 224 7374 + =20 +http://www.greenplum.com=20 + +GreenPlum, Inc. +1900 South Norfolk Street, Suite 224 +San Mateo, California 94403 USA + + +From pgsql-performance-owner@postgresql.org Wed Jul 6 21:37:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B102452835 + for ; + Wed, 6 Jul 2005 21:37:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23028-02 + for ; + Thu, 7 Jul 2005 00:37:55 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 1094652808 + for ; + Wed, 6 Jul 2005 21:37:54 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7579489; Wed, 06 Jul 2005 17:40:05 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: paul@oxton.com +Subject: Re: Data Warehousing Tuning +Date: Wed, 6 Jul 2005 17:40:12 -0700 +User-Agent: KMail/1.8 +Cc: pgsql-performance@postgresql.org +References: <3688.217.45.209.171.1120670147.squirrel@www.gradwell.com> +In-Reply-To: <3688.217.45.209.171.1120670147.squirrel@www.gradwell.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200507061740.12875.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/57 +X-Sequence-Number: 13298 + +Paul, + +> Has anyone experienced real performance gains by moving the pg_xlog +> files? + +Yes. Both for data load and on OLTP workloads, this increased write +performance by as much as 15%. However, you need to configure the xlog +drive correctly, you can't just move it to a new disk. Make sure the +other disk is dedicated exclusively to the xlog, set it forcedirectio, and +increase your checkpoint_segments to something like 128. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Jul 7 04:42:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 606D252A15 + for ; + Thu, 7 Jul 2005 04:42:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34922-06 + for ; + Thu, 7 Jul 2005 07:41:54 +0000 (GMT) +Received: from dns.texnet.it (dns.texnet.it [217.19.150.6]) + by svr1.postgresql.org (Postfix) with ESMTP id B686852A0A + for ; + Thu, 7 Jul 2005 04:41:52 -0300 (ADT) +Received: from pool-a-150.texnet.it ([217.19.150.150] helo=paros.rigacci.org) + by dns.texnet.it with esmtp (Exim 3.35 #1 (Debian)) + id 1DqR13-0000qJ-00; Thu, 07 Jul 2005 09:41:49 +0200 +Received: from niccolo by paros.rigacci.org with local (Exim 4.50) + id 1DqR11-0004HG-V5; Thu, 07 Jul 2005 09:41:47 +0200 +Date: Thu, 7 Jul 2005 09:41:47 +0200 +To: John A Meinel +Cc: Postgresql Performance +Subject: Re: CURSOR slowes down a WHERE clause 100 times? +Message-ID: <20050707074147.GA16360@rigacci.org> +References: <20050706211946.GA3460@rigacci.org> + <42CC4D1C.9040606@arbash-meinel.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42CC4D1C.9040606@arbash-meinel.com> +User-Agent: Mutt/1.5.9i +From: Niccolo Rigacci +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.153 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200507/58 +X-Sequence-Number: 13299 + +> >Can the CURSOR on JOIN affects so heavly the WHERE clause? I +> >suspect that - with the CURSOR - a sequential scan is performed +> >on the entire data set for each fetched record... +> > +> >Any idea? +> > +> > +> What does it say if you do "EXPLAIN ANALYZE SELECT..." both with and +> without the cursor? +> It may not say much for the cursor, but I think you can explain analyze +> the fetch statements. + +How can I EXPLAIN ANALYZE a cursor like this? + + BEGIN; + DECLARE mycursor BINARY CURSOR FOR + SELECT ... + FETCH ALL IN mycursor; + END; + +I tried to put EXPLAIN ANALYZE in front of the SELECT and in +front of the FETCH, but I got two "syntax error"... + +Thanks + +-- +Niccolo Rigacci +Firenze - Italy + +War against Iraq? Not in my name! + +From pgsql-performance-owner@postgresql.org Thu Jul 7 05:13:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6612C529F3 + for ; + Thu, 7 Jul 2005 05:13:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 41190-09 + for ; + Thu, 7 Jul 2005 08:13:27 +0000 (GMT) +Received: from dns.texnet.it (dns.texnet.it [217.19.150.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 97F8C529BE + for ; + Thu, 7 Jul 2005 05:13:27 -0300 (ADT) +Received: from pool-a-150.texnet.it ([217.19.150.150] helo=paros.rigacci.org) + by dns.texnet.it with esmtp (Exim 3.35 #1 (Debian)) + id 1DqRVg-00042R-00 + for ; Thu, 07 Jul 2005 10:13:28 +0200 +Received: from niccolo by paros.rigacci.org with local (Exim 4.50) + id 1DqRVf-0004TL-VP + for pgsql-performance@postgresql.org; Thu, 07 Jul 2005 10:13:27 +0200 +Date: Thu, 7 Jul 2005 10:13:27 +0200 +To: pgsql-performance@postgresql.org +Subject: Re: CURSOR slowes down a WHERE clause 100 times? +Message-ID: <20050707081327.GA17054@rigacci.org> +References: <20050706211946.GA3460@rigacci.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050706211946.GA3460@rigacci.org> +User-Agent: Mutt/1.5.9i +From: Niccolo Rigacci +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.102 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/59 +X-Sequence-Number: 13300 + +On Wed, Jul 06, 2005 at 11:19:46PM +0200, Niccolo Rigacci wrote: +> +> I have a performace problem with the following query: +> +> BEGIN; +> DECLARE mycursor BINARY CURSOR FOR +> SELECT +> toponimo, +> wpt +> FROM wpt_comuni_view +> WHERE ( +> wpt && +> setSRID('BOX3D(4.83 36, 20.16 47.5)'::BOX3D, 4326) +> ); +> FETCH ALL IN mycursor; +> END; +> +> I get the results in about 108 seconds (8060 rows). +> +> If I issue the SELECT alone (without the CURSOR) I get the +> same results in less than 1 second. + +By trial and error I discovered that adding an "ORDER BY +toponimo" clause to the SELECT, boosts the CURSOR performances +so that they are now equiparable to the SELECT alone. + +Is there some documentation on how an ORDER can affect the +CURSOR in a different way than the SELECT? + +-- +Niccolo Rigacci +Firenze - Italy + +War against Iraq? Not in my name! + +From pgsql-performance-owner@postgresql.org Thu Jul 7 06:15:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4B6BF52986 + for ; + Thu, 7 Jul 2005 06:15:35 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51953-05 + for ; + Thu, 7 Jul 2005 09:15:30 +0000 (GMT) +Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) + by svr1.postgresql.org (Postfix) with ESMTP id 96E5C52930 + for ; + Thu, 7 Jul 2005 06:15:21 -0300 (ADT) +Received: from mainbox.archonet.com + (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) + by smtp.metronet.co.uk (MetroNet Mail) with ESMTP + id 2B7A040EF94; Thu, 7 Jul 2005 10:15:16 +0100 (BST) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP id ADAD915ED6; + Thu, 7 Jul 2005 10:14:53 +0100 (BST) +Received: from mainbox.archonet.com ([127.0.0.1]) + by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 20598-09; Thu, 7 Jul 2005 10:14:50 +0100 (BST) +Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP id 9232E15ED5; + Thu, 7 Jul 2005 10:14:50 +0100 (BST) +Message-ID: <42CCF28A.3010403@archonet.com> +Date: Thu, 07 Jul 2005 10:14:50 +0100 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Niccolo Rigacci +Cc: pgsql-performance@postgresql.org +Subject: Re: CURSOR slowes down a WHERE clause 100 times? +References: <20050706211946.GA3460@rigacci.org> + <20050707081327.GA17054@rigacci.org> +In-Reply-To: <20050707081327.GA17054@rigacci.org> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/60 +X-Sequence-Number: 13301 + +Niccolo Rigacci wrote: +>> +>>I get the results in about 108 seconds (8060 rows). +>> +>>If I issue the SELECT alone (without the CURSOR) I get the +>>same results in less than 1 second. +> +> +> By trial and error I discovered that adding an "ORDER BY +> toponimo" clause to the SELECT, boosts the CURSOR performances +> so that they are now equiparable to the SELECT alone. +> +> Is there some documentation on how an ORDER can affect the +> CURSOR in a different way than the SELECT? + +I think you're misunderstanding exactly what's happening here. If you +ask for a cursor, PG assumes you aren't going to want all the results +(or at least not straight away). After all, most people use them to work +through results in comparatively small chunks, perhaps only ever +fetching 1% of the total results. + +So - if you ask for a cursor, PG weights things to give you the first +few rows as soon as possible, at the expense of fetching *all* rows +quickly. If you're only going to fetch e.g. the first 20 rows this is +exactly what you want. In your case, since you're immediately issuing +FETCH ALL, you're not really using the cursor at all, but PG doesn't +know that. + +So - the ORDER BY means PG has to sort all the results before returning +the first row anyway. That probably means the plans with/without cursor +are identical. + +Of course, all this assumes that your configuration settings are good +and statistics adequate. To test that, try fetching just the first row +from your cursor with/without the ORDER BY. Without should be quicker. + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Thu Jul 7 07:07:06 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C46552996 + for ; + Thu, 7 Jul 2005 07:07:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62964-03 + for ; + Thu, 7 Jul 2005 10:06:57 +0000 (GMT) +Received: from dns.texnet.it (dns.texnet.it [217.19.150.6]) + by svr1.postgresql.org (Postfix) with ESMTP id 5C1F352816 + for ; + Thu, 7 Jul 2005 07:06:56 -0300 (ADT) +Received: from pool-a-150.texnet.it ([217.19.150.150] helo=paros.rigacci.org) + by dns.texnet.it with esmtp (Exim 3.35 #1 (Debian)) + id 1DqTHX-0005yK-00 + for ; Thu, 07 Jul 2005 12:06:59 +0200 +Received: from niccolo by paros.rigacci.org with local (Exim 4.50) + id 1DqTHW-00056m-G5 + for pgsql-performance@postgresql.org; Thu, 07 Jul 2005 12:06:58 +0200 +Date: Thu, 7 Jul 2005 12:06:58 +0200 +To: pgsql-performance@postgresql.org +Subject: Re: CURSOR slowes down a WHERE clause 100 times? +Message-ID: <20050707100658.GA19237@rigacci.org> +References: <20050706211946.GA3460@rigacci.org> + <20050707081327.GA17054@rigacci.org> + <42CCF28A.3010403@archonet.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42CCF28A.3010403@archonet.com> +User-Agent: Mutt/1.5.9i +From: Niccolo Rigacci +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.084 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/61 +X-Sequence-Number: 13302 + +On Thu, Jul 07, 2005 at 10:14:50AM +0100, Richard Huxton wrote: +> >By trial and error I discovered that adding an "ORDER BY +> >toponimo" clause to the SELECT, boosts the CURSOR performances +> >so that they are now equiparable to the SELECT alone. + +> I think you're misunderstanding exactly what's happening here. If you +> ask for a cursor, PG assumes you aren't going to want all the results +> (or at least not straight away). After all, most people use them to work +> through results in comparatively small chunks, perhaps only ever +> fetching 1% of the total results. + +This make finally sense! + +> In your case, since you're immediately issuing FETCH ALL, +> you're not really using the cursor at all, but PG doesn't know +> that. + +In fact, fetching only the first rows from the cursor, is rather +quick! This demonstrates that the PG planner is smart. + +Not so smart are the MapServer and QGIS query builders, which use +a CURSOR to FETCH ALL. + +I will investigate in this direction now. + +Thank you very much, your help was excellent! + +-- +Niccolo Rigacci +Firenze - Italy + +War against Iraq? Not in my name! + +From pgsql-performance-owner@postgresql.org Thu Jul 7 08:19:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0665952816 + for ; + Thu, 7 Jul 2005 08:16:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76379-06 + for ; + Thu, 7 Jul 2005 11:16:40 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) + by svr1.postgresql.org (Postfix) with ESMTP id 683F8529BF + for ; + Thu, 7 Jul 2005 08:16:36 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 69so178096wri + for ; + Thu, 07 Jul 2005 04:16:40 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; + b=MqFLFn6b6HYDLVpxEECKfPkuwfc0FNn0Rp76D87fR/A4nuKAxWrNAVB8Uekw/UBSsS8hkvvwxaCCkG4s2cr1j5JcvfV6FBSukR76cTcliyjOO1pn26YgtzsLOjs89k1+dhgThsUiYDtHZHM5NXE3QrTKa1ttDUJlPEe+KE3vhEM= +Received: by 10.54.29.10 with SMTP id c10mr615683wrc; + Thu, 07 Jul 2005 04:16:39 -0700 (PDT) +Received: from ?10.80.1.45? ([194.248.208.82]) + by mx.gmail.com with ESMTP id d61sm1040970wra.2005.07.07.04.16.39; + Thu, 07 Jul 2005 04:16:39 -0700 (PDT) +Mime-Version: 1.0 (Apple Message framework v728) +Content-Transfer-Encoding: 7bit +Message-Id: <6F239216-7936-4E62-B708-46DC9171649C@gmail.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +To: pgsql-performance@postgresql.org +From: Bendik Rognlien Johansen +Subject: How to speed up delete +Date: Thu, 7 Jul 2005 13:16:30 +0200 +X-Mailer: Apple Mail (2.728) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.141 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/62 +X-Sequence-Number: 13303 + +Hello, +I was wondering if there is any way to speed up deletes on this table +(see details below)? +I am running few of these deletes (could become many more) inside a +transaction and each one takes allmost a second to complete. +Is it because of the foreign key constraint, or is it something else? + +Thanks! + + Table "public.contacts" + Column | Type | +Modifiers +-------------+------------------------ ++---------------------------------------------------------- +id | integer | not null default nextval +('public.contacts_id_seq'::text) +record | integer | +type | integer | +value | character varying(128) | +description | character varying(255) | +priority | integer | +itescotype | integer | +original | integer | +Indexes: + "contacts_pkey" PRIMARY KEY, btree (id) + "contacts_record_idx" btree (record) +Foreign-key constraints: + "contacts_original_fkey" FOREIGN KEY (original) REFERENCES +contacts(id) + +dev=# select count(id) from contacts; +count +-------- +984834 +(1 row) + + +dev=# explain analyze DELETE FROM contacts WHERE id = 985458; + QUERY PLAN +------------------------------------------------------------------------ +------------------------------------------------ +Index Scan using contacts_pkey on contacts (cost=0.00..3.01 rows=1 +width=6) (actual time=0.043..0.049 rows=1 loops=1) + Index Cond: (id = 985458) +Total runtime: 840.481 ms +(3 rows) + + +From pgsql-performance-owner@postgresql.org Thu Jul 7 09:42:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AA97752815 + for ; + Thu, 7 Jul 2005 09:42:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93537-04 + for ; + Thu, 7 Jul 2005 12:42:06 +0000 (GMT) +Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.197]) + by svr1.postgresql.org (Postfix) with ESMTP id 1B1B8528A6 + for ; + Thu, 7 Jul 2005 09:42:04 -0300 (ADT) +Received: by nproxy.gmail.com with SMTP id o25so47377nfa + for ; + Thu, 07 Jul 2005 05:42:08 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; + b=b9rqCUvtOM1OWWIL5dfvlnm6HBcH/w8CxJToeG14i60NpSLqaOGlSJUj0OklPN5djx2MSCWHECDQTWJVAhGGrJj1N0YzqQCe2Uip3CtOWAYVSOK67UyM1A3njLnXlmLQ0YhmvR/gohVY5bhN71u/FcCR209Nr1htluMCPctuy6w= +Received: by 10.48.237.18 with SMTP id k18mr30206nfh; + Thu, 07 Jul 2005 05:42:08 -0700 (PDT) +Received: by 10.48.49.14 with HTTP; Thu, 7 Jul 2005 05:42:08 -0700 (PDT) +Message-ID: <4b09a0c0507070542fd0d197@mail.gmail.com> +Date: Thu, 7 Jul 2005 14:42:08 +0200 +From: Jean-Max Reymond +Reply-To: Jean-Max Reymond +To: pgsql-performance@postgresql.org +Subject: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.834 tagged_above=0 required=5 tests=AWL, + MISSING_SUBJECT, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/63 +X-Sequence-Number: 13304 + +Hi, +These last two days, I have some troubles with a very strange phenomena: +I have a 400 Mb database and a stored procedure written in perl which +call 14 millions times spi_exec_query (thanks to Tom to fix the memory +leak ;-) ). +On my laptop whith Centrino 1.6 GHz, 512 Mb RAM, + - it is solved in 1h50' for Linux 2.6 + - it is solved in 1h37' for WXP Professionnal ( WXP better +tan Linux ;-) ) +On a Desktop with PIV 2.8 GHz,=20 + - it is solved in 3h30 for W2K +On a Desktop with PIV 1.8 GHz, two disks with data and index's on each disk + - it is solved in 4h for W2K + +I test CPU, memory performance on my laptop and it seems that the +performances are not perfect except for one single test: String sort. + +So, it seems that for my application (database in memory, 14 millions +of very small requests), Centrino (aka Pentium M) has a build-in +hardware to boost Postgres performance :-) +Any experience to confirm this fact ? + +--=20 +Jean-Max Reymond +CKR Solutions Open Source +Nice France +http://www.ckr-solutions.com + +From pgsql-performance-owner@postgresql.org Thu Jul 7 09:49:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C974C5288B + for ; + Thu, 7 Jul 2005 09:49:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94289-06 + for ; + Thu, 7 Jul 2005 12:49:05 +0000 (GMT) +Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.202]) + by svr1.postgresql.org (Postfix) with ESMTP id B019852A08 + for ; + Thu, 7 Jul 2005 09:49:01 -0300 (ADT) +Received: by nproxy.gmail.com with SMTP id x4so49067nfb + for ; + Thu, 07 Jul 2005 05:49:05 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; + b=ui/eiu5TFXZzCBbGwP/pUlZQj6YhaC0vyjgOmvU9cHJQd8HGPpZMHE9vHepkKb65fm1jXZiIK7+hLnqy/I853fDLksccuMfNrDxJLQx4M2ZYNlhzm5gyo/DI9Pn2z0kbkO4zH7Unf0IUDNbm6kuEr8eQKHxG07KKu8YSpz68Ul4= +Received: by 10.48.237.18 with SMTP id k18mr30583nfh; + Thu, 07 Jul 2005 05:49:05 -0700 (PDT) +Received: by 10.48.49.14 with HTTP; Thu, 7 Jul 2005 05:49:05 -0700 (PDT) +Message-ID: <4b09a0c05070705495df28801@mail.gmail.com> +Date: Thu, 7 Jul 2005 14:49:05 +0200 +From: Jean-Max Reymond +Reply-To: Jean-Max Reymond +To: pgsql-performance@postgresql.org +Subject: Surprizing performances for Postgres on Centrino +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.08 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/64 +X-Sequence-Number: 13305 + +Hi, +These last two days, I have some troubles with a very strange phenomena: +I have a 400 Mb database and a stored procedure written in perl which +call 14 millions times spi_exec_query (thanks to Tom to fix the memory +leak ;-) ). +On my laptop whith Centrino 1.6 GHz, 512 Mb RAM, +- it is solved in 1h50' for Linux 2.6 +- it is solved in 1h37' for WXP Professionnal ( WXP better +tan Linux ;-) ) +On a Desktop with PIV 2.8 GHz, +- it is solved in 3h30 for W2K +On a Desktop with PIV 1.8 GHz, two disks with data and index's on each disk +- it is solved in 4h for W2K + +I test CPU, memory performance on my laptop and it seems that the +performances are not perfect except for one single test: String sort. + +So, it seems that for my application (database in memory, 14 millions +of very small requests), Centrino (aka Pentium M) has a build-in +hardware to boost Postgres performance :-) +Any experience to confirm this fact ? +Some tips to speed up Postgres on non-Centrino processors ? + +--=20 +Jean-Max Reymond +CKR Solutions Open Source +Nice France +http://www.ckr-solutions.com + +From pgsql-performance-owner@postgresql.org Thu Jul 7 09:55:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F363452923 + for ; + Thu, 7 Jul 2005 09:55:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95038-09 + for ; + Thu, 7 Jul 2005 12:55:30 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id DA3D652823 + for ; + Thu, 7 Jul 2005 09:55:26 -0300 (ADT) +Received: (qmail 8571 invoked from network); 7 Jul 2005 14:55:56 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 7 Jul 2005 14:55:56 +0200 +To: "Bendik Rognlien Johansen" , + pgsql-performance@postgresql.org +Subject: Re: How to speed up delete +References: <6F239216-7936-4E62-B708-46DC9171649C@gmail.com> +Message-ID: +Date: Thu, 07 Jul 2005 14:55:28 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <6F239216-7936-4E62-B708-46DC9171649C@gmail.com> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/65 +X-Sequence-Number: 13306 + +On Thu, 07 Jul 2005 13:16:30 +0200, Bendik Rognlien Johansen + wrote: + +> Hello, +> I was wondering if there is any way to speed up deletes on this table +> (see details below)? +> I am running few of these deletes (could become many more) inside a +> transaction and each one takes allmost a second to complete. +> Is it because of the foreign key constraint, or is it something else? +> +> Thanks! + + Check your references : on delete, pg needs to find which rows to +cascade-delete, or set null, or restrict, in the tables which reference +this one. Also if this table references another I think it will lookup it +too. Do you have indexes for all this ? + +From pgsql-performance-owner@postgresql.org Thu Jul 7 10:03:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 255DB528CE + for ; + Thu, 7 Jul 2005 10:03:39 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99310-04 + for ; + Thu, 7 Jul 2005 13:03:20 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 44F785288B + for ; + Thu, 7 Jul 2005 10:03:18 -0300 (ADT) +Received: (qmail 9038 invoked from network); 7 Jul 2005 15:03:49 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 7 Jul 2005 15:03:49 +0200 +Date: Thu, 07 Jul 2005 15:03:22 +0200 +To: "Jean-Max Reymond" , pgsql-performance@postgresql.org +Subject: Re: +References: <4b09a0c0507070542fd0d197@mail.gmail.com> +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-ID: +In-Reply-To: <4b09a0c0507070542fd0d197@mail.gmail.com> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/66 +X-Sequence-Number: 13307 + + +> So, it seems that for my application (database in memory, 14 millions +> of very small requests), Centrino (aka Pentium M) has a build-in +> hardware to boost Postgres performance :-) +> Any experience to confirm this fact ? + + On my Centrino, Python flies. This might be due to the very large +processor cache. Probably it is the same for perl. With two megabytes of +cache, sorting things that fit into the cache should be a lot faster too. +Maybe this explains it. + + Check this out : + +http://www.anandtech.com/linux/showdoc.aspx?i=2308&p=5 + +http://www.anandtech.com/cpuchipsets/showdoc.aspx?i=2129&p=11 + + Bonus for Opteron lovers : + +"The Dual Opteron 252's lead by 19% over the Quad Xeon 3.6 GHz 667MHz FSB" + +http://www.anandtech.com/cpuchipsets/showdoc.aspx?i=2397&p=12 + +From pgsql-performance-owner@postgresql.org Thu Jul 7 10:14:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2ABDC5298E + for ; + Thu, 7 Jul 2005 10:14:17 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02547-03 + for ; + Thu, 7 Jul 2005 13:14:15 +0000 (GMT) +Received: from tomts25-srv.bellnexxia.net (tomts25.bellnexxia.net + [209.226.175.188]) + by svr1.postgresql.org (Postfix) with ESMTP id BA9E4529EA + for ; + Thu, 7 Jul 2005 10:14:11 -0300 (ADT) +Received: from [192.168.1.99] ([216.208.56.114]) by tomts25-srv.bellnexxia.net + (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP + id <20050707131413.CUPQ27245.tomts25-srv.bellnexxia.net@[192.168.1.99]> + for ; + Thu, 7 Jul 2005 09:14:13 -0400 +Message-ID: <42CD2A7A.10603@alteeve.com> +Date: Thu, 07 Jul 2005 09:13:30 -0400 +From: Madison Kelly +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 +X-Accept-Language: en-us, en, ja +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Need suggestion high-level suggestion on how to solve a performance + problem +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/67 +X-Sequence-Number: 13308 + +Hi all, + + I hope I am not asking too many questions. :) + + I have been trying to solve a performance problem in my program for a +while now and, after getting an index to work which didn't speed things +up enough, I am stumped. I am hoping someone here might have come across +a similar issue and came up with a creative solution they wouldn't mind +sharing. + + I am not looking for details, I expect to do my homework, I just need +a pointer, suggestion or trick. + + The problem I have is that I am using pgSQL as a back end for my +web-based *nix backup program. Part of the database stores info on every +file and directory per partition. I use this information to build my +directory tree. I have a test partition with ~325,000 files of which +~30,000 are directories. I have been able to get the performance up to a +reasonable level for displaying the directory tree including expanding +and contracting branches (~3-5sec). I do this by loading all the +directory info into an array and a hash once and using them as needed +instead of hitting the DB. + + The problem comes when the user toggles a directory branch's backup +flag (a simple check box beside the directory name). If it's a directory +near the end of a branch it is fast enough. If they toggle a single file +it is nearly instant. However if they toggle say the root directory, so +every file and directory below it needs to be updated, it can take +500-600sec to return. Obviously this is no good. + + What I need is a scheme for being able to say, essentially: + +UPDATE file_info_1 SET file_backup='t' WHERE file_parent_dir~'^/'; + + Faster. An index isn't enough because it needs to hit every entry anyway. + + I use perl to access the DB and generate the web pages. The file +browser portion looks and acts like most file browsers (directory tree +in the left frame with expanding and contracting directory branches and +a list of files in a given directory on the right). It does not use any +plug-ins like Java and that is important to me that it stays that way (I +want it to be as simple as possible for the user to install). + + So far the only suggestion I've received is to keep a secondary +'delta' table to store just the request. Then on load get the existing +data then check it against the delta table before creating the page. The +biggest draw back for me with this is that currently I don't need to +provide an 'Apply' button because a simple javascript call passes the +request onto the perl script immediately. I really like the Mac-esque +approach to keeping the UI as simple and straight forward as possible. +So, a suggestion that doesn't require something like an 'Apply' button +would be much appreciated. + + Thanks for any suggestions in advance! + +Madison + +PS - For what it's worth, this is the last hurdle for me to overcome +before I can finally release my program as 'beta' after over 15 months +of work! :) + +From pgsql-performance-owner@postgresql.org Thu Jul 7 10:48:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9249552923 + for ; + Thu, 7 Jul 2005 10:48:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06089-10 + for ; + Thu, 7 Jul 2005 13:48:07 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.207]) + by svr1.postgresql.org (Postfix) with ESMTP id 7DE8C529EA + for ; + Thu, 7 Jul 2005 10:48:01 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 8so87528nzo + for ; + Thu, 07 Jul 2005 06:48:06 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=KPGx8DJlLtmcLu9s/RtKbBpALPUTChZivZKTdWkhEe3qb0hg0rbka/wCIJqHZDTNGpuEBX4lrbw2itGSwObi8SDnbf0LXMU98SaLK8ikUOGltBQW5O3Dfa3YQXoATq6hBHFKrRY4F22hktDO87JvlEUzN2Cl0PMnBSf47VNbKJ8= +Received: by 10.36.222.46 with SMTP id u46mr294300nzg; + Thu, 07 Jul 2005 06:48:06 -0700 (PDT) +Received: by 10.36.22.20 with HTTP; Thu, 7 Jul 2005 06:48:06 -0700 (PDT) +Message-ID: <758d5e7f05070706481ef034d4@mail.gmail.com> +Date: Thu, 7 Jul 2005 15:48:06 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: Jean-Max Reymond +Subject: Re: Surprizing performances for Postgres on Centrino +Cc: Postgresql Performance +In-Reply-To: <4b09a0c05070705495df28801@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <4b09a0c05070705495df28801@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.613 tagged_above=0 required=5 tests=AWL, + FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/68 +X-Sequence-Number: 13309 + +On 7/7/05, Jean-Max Reymond wrote: +> On my laptop whith Centrino 1.6 GHz, 512 Mb RAM, +> - it is solved in 1h50' for Linux 2.6 +> - it is solved in 1h37' for WXP Professionnal ( WXP better +> tan Linux ;-) ) +[...] +> I test CPU, memory performance on my laptop and it seems that the +> performances are not perfect except for one single test: String sort. + +Well, Pentium 4 is not the most efficient processor around (despite +all the advertisiing and all the advanced hyper features). Sure it +reaches high GHz rates, but that's not what matters the most. +This is why AMD stopped giving GHz ratings and instead uses numbers +which indicate how their processor relate to Pentium 4s. For instance +AMD Athlon XP 1700+ is running at 1.45 GHz, but competes with +Pentium 4 1.7 GHz. + +Same is with Intels Pentium-III line (which evolved into Pentium-M +Centrino actually). Like AMD Athlon, Pentium-M is more efficient +about its clockspeed than Pentium 4. In other words, you shouldn't +compare Pentium 4 and Pentium-M clock-by-clock. Pentium 4 +just needs more GHz to do same job as Pentium-M or Athlon. + +If you want to get some better (more technical) information, just +google around for reviews and articles. There are plenty of them +recently since Apple intends to use Pentium-M as their future +platform, at least for notebooks. As for technical stuff, for instance +look at: +http://www.tomshardware.com/howto/20050621/37watt-pc-02.html + +What really is interesting is the performance difference between +WXP and L26... Are you sure they use exactly the same config +parameters (shared buffers) and have similar statistics (both +VACUUM ANALYZEd recently)? + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Thu Jul 7 10:59:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D427E52A11 + for ; + Thu, 7 Jul 2005 10:59:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07513-08 + for ; + Thu, 7 Jul 2005 13:59:34 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 115B1528CE + for ; + Thu, 7 Jul 2005 10:59:33 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j67DxX2l007485; + Thu, 7 Jul 2005 09:59:33 -0400 (EDT) +To: Niccolo Rigacci +Cc: John A Meinel , + Postgresql Performance +Subject: Re: CURSOR slowes down a WHERE clause 100 times? +In-reply-to: <20050707074147.GA16360@rigacci.org> +References: <20050706211946.GA3460@rigacci.org> + <42CC4D1C.9040606@arbash-meinel.com> + <20050707074147.GA16360@rigacci.org> +Comments: In-reply-to Niccolo Rigacci + message dated "Thu, 07 Jul 2005 09:41:47 +0200" +Date: Thu, 07 Jul 2005 09:59:33 -0400 +Message-ID: <7484.1120744773@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.109 tagged_above=0 required=5 tests=AWL, + UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200507/69 +X-Sequence-Number: 13310 + +Niccolo Rigacci writes: +> How can I EXPLAIN ANALYZE a cursor like this? + +> BEGIN; +> DECLARE mycursor BINARY CURSOR FOR +> SELECT ... +> FETCH ALL IN mycursor; +> END; + +> I tried to put EXPLAIN ANALYZE in front of the SELECT and in +> front of the FETCH, but I got two "syntax error"... + +Just FYI, you can't EXPLAIN ANALYZE this, but you can EXPLAIN it: + + EXPLAIN DECLARE x CURSOR FOR ... + +so you can at least find out what the plan is. + +It might be cool to support EXPLAIN ANALYZE FETCH --- not sure what that +would take. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 7 11:02:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 15C3352A1A + for ; + Thu, 7 Jul 2005 11:02:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09802-09 + for ; + Thu, 7 Jul 2005 14:02:31 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C152F52A0E + for ; + Thu, 7 Jul 2005 11:02:21 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j67E2PvJ007518; + Thu, 7 Jul 2005 10:02:25 -0400 (EDT) +To: Bendik Rognlien Johansen +Cc: pgsql-performance@postgresql.org +Subject: Re: How to speed up delete +In-reply-to: <6F239216-7936-4E62-B708-46DC9171649C@gmail.com> +References: <6F239216-7936-4E62-B708-46DC9171649C@gmail.com> +Comments: In-reply-to Bendik Rognlien Johansen + message dated "Thu, 07 Jul 2005 13:16:30 +0200" +Date: Thu, 07 Jul 2005 10:02:25 -0400 +Message-ID: <7517.1120744945@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/70 +X-Sequence-Number: 13311 + +Bendik Rognlien Johansen writes: +> I am running few of these deletes (could become many more) inside a +> transaction and each one takes allmost a second to complete. +> Is it because of the foreign key constraint, or is it something else? + +You need an index on "original" to support that FK efficiently. Check +for references from other tables to this one, too. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 7 11:03:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B77AC52A16 + for ; + Thu, 7 Jul 2005 11:03:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11537-07 + for ; + Thu, 7 Jul 2005 14:03:03 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id DBB5B52A03 + for ; + Thu, 7 Jul 2005 11:03:01 -0300 (ADT) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.50) + id 1DqWxx-0005IL-Md; Thu, 07 Jul 2005 16:03:03 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1DqWxw-0008BT-00; Thu, 07 Jul 2005 16:03:00 +0200 +Date: Thu, 7 Jul 2005 16:03:00 +0200 +From: "Steinar H. Gunderson" +To: Dawid Kuroczko +Cc: Jean-Max Reymond , + Postgresql Performance +Subject: Re: Surprizing performances for Postgres on Centrino +Message-ID: <20050707140300.GA31348@uio.no> +Mail-Followup-To: Dawid Kuroczko , + Jean-Max Reymond , + Postgresql Performance +References: <4b09a0c05070705495df28801@mail.gmail.com> + <758d5e7f05070706481ef034d4@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <758d5e7f05070706481ef034d4@mail.gmail.com> +X-Operating-System: Linux 2.6.11.8 on a i686 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.018 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/71 +X-Sequence-Number: 13312 + +On Thu, Jul 07, 2005 at 03:48:06PM +0200, Dawid Kuroczko wrote: +> This is why AMD stopped giving GHz ratings and instead uses numbers +> which indicate how their processor relate to Pentium 4s. For instance +> AMD Athlon XP 1700+ is running at 1.45 GHz, but competes with +> Pentium 4 1.7 GHz. + +Actually, the XP ratings are _Athlon Thunderbird_ ratings, not P4 ratings. At +least they were intended to be that originally :-) + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Thu Jul 7 11:09:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DE40852815 + for ; + Thu, 7 Jul 2005 11:09:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10644-06 + for ; + Thu, 7 Jul 2005 14:09:32 +0000 (GMT) +Received: from mr1.surnet.cl (smtp1.surnet.cl [216.155.73.162]) + by svr1.postgresql.org (Postfix) with ESMTP id 847EC52A09 + for ; + Thu, 7 Jul 2005 11:09:32 -0300 (ADT) +Received: from smtp1.surnet.cl (216.155.73.168) by mr1.surnet.cl (7.0.031.3) + id 42587EDE013A5F14; Thu, 7 Jul 2005 10:08:58 -0400 +Received: from smtp2.surnet.cl (smtp2.surnet.cl []) + by mr1.surnet.cl ([216.155.73.168]); Thu, 07 Jul 2005 14:08:58 +0000 +Received: from cluster.surnet.cl (216.155.73.164) by smtp2.surnet.cl + (7.0.031.3) id 4259ADE300C05169; Thu, 7 Jul 2005 10:09:23 -0400 +Received: from alvh.no-ip.org (200.85.217.230) by cluster.surnet.cl (7.0.043) + (authenticated as alvherre@surnet.cl) + id 42B3EF60002B0D8F; Thu, 7 Jul 2005 10:09:34 -0400 +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id 2BBDFC2D425; Thu, 7 Jul 2005 10:09:34 -0400 (CLT) +Date: Thu, 7 Jul 2005 10:09:34 -0400 +From: Alvaro Herrera +To: Jean-Max Reymond +Cc: pgsql-performance@postgresql.org +Subject: Re: Surprizing performances for Postgres on Centrino +Message-ID: <20050707140934.GB6139@alvh.no-ip.org> +References: <4b09a0c05070705495df28801@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <4b09a0c05070705495df28801@mail.gmail.com> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.45 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, RCVD_IN_NJABL_PROXY +X-Spam-Level: * +X-Archive-Number: 200507/72 +X-Sequence-Number: 13313 + +On Thu, Jul 07, 2005 at 02:49:05PM +0200, Jean-Max Reymond wrote: +> Hi, +> These last two days, I have some troubles with a very strange phenomena: +> I have a 400 Mb database and a stored procedure written in perl which +> call 14 millions times spi_exec_query (thanks to Tom to fix the memory +> leak ;-) ). +> On my laptop whith Centrino 1.6 GHz, 512 Mb RAM, +> - it is solved in 1h50' for Linux 2.6 +> - it is solved in 1h37' for WXP Professionnal ( WXP better +> tan Linux ;-) ) +> On a Desktop with PIV 2.8 GHz, +> - it is solved in 3h30 for W2K +> On a Desktop with PIV 1.8 GHz, two disks with data and index's on each disk +> - it is solved in 4h for W2K + +Do you have the same locale settings on all of them? + +-- +Alvaro Herrera () +"We are who we choose to be", sang the goldfinch +when the sun is high (Sandman) + +From pgsql-performance-owner@postgresql.org Thu Jul 7 11:23:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D278D52A0D + for ; + Thu, 7 Jul 2005 11:23:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19647-01 + for ; + Thu, 7 Jul 2005 14:23:15 +0000 (GMT) +Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.207]) + by svr1.postgresql.org (Postfix) with ESMTP id 5227352A09 + for ; + Thu, 7 Jul 2005 11:23:14 -0300 (ADT) +Received: by nproxy.gmail.com with SMTP id x37so55488nfc + for ; + Thu, 07 Jul 2005 07:23:18 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=hdI12fkAqS5vX/2HshcWxWlma2P3YKyyTUkPjXi+GsB2x9343IN9SmYJCKf9W67YpwKp8NpEAxDkwatnaaKBEUnRSK6AigMoaUPVqN7ogOFdNaRTZSuaNL50r+vQ1wimI6UxVulfP56wScYQ5uwsPJBvHKMIf24PZoE0lc3vwkk= +Received: by 10.48.3.15 with SMTP id 15mr35731nfc; + Thu, 07 Jul 2005 07:23:18 -0700 (PDT) +Received: by 10.48.49.14 with HTTP; Thu, 7 Jul 2005 07:23:18 -0700 (PDT) +Message-ID: <4b09a0c050707072372e87ce6@mail.gmail.com> +Date: Thu, 7 Jul 2005 16:23:18 +0200 +From: Jean-Max Reymond +Reply-To: Jean-Max Reymond +To: pgsql-performance@postgresql.org +Subject: Re: Surprizing performances for Postgres on Centrino +In-Reply-To: <20050707140934.GB6139@alvh.no-ip.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <4b09a0c05070705495df28801@mail.gmail.com> + <20050707140934.GB6139@alvh.no-ip.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.076 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/73 +X-Sequence-Number: 13314 + +On 7/7/05, Alvaro Herrera wrote: + +>=20 +> Do you have the same locale settings on all of them? +>=20 + +interressant: +UNICODE on the fast laptop +SQL_ASCII on the slowest desktops. +is UNICODE database faster than SQL_ASCII ? + +--=20 +Jean-Max Reymond +CKR Solutions Open Source +Nice France +http://www.ckr-solutions.com + +From pgsql-performance-owner@postgresql.org Thu Jul 7 11:55:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C06A52A21 + for ; + Thu, 7 Jul 2005 11:55:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25592-02 + for ; + Thu, 7 Jul 2005 14:55:20 +0000 (GMT) +Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) + by svr1.postgresql.org (Postfix) with ESMTP id 0C52252A1B + for ; + Thu, 7 Jul 2005 11:55:18 -0300 (ADT) +Received: from mainbox.archonet.com + (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) + by smtp.metronet.co.uk (MetroNet Mail) with ESMTP + id AB9C940C4C3; Thu, 7 Jul 2005 15:55:11 +0100 (BST) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP id 4FBB9FF73; + Thu, 7 Jul 2005 15:54:02 +0100 (BST) +Received: from mainbox.archonet.com ([127.0.0.1]) + by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 03370-08; Thu, 7 Jul 2005 15:53:57 +0100 (BST) +Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP id 91927FF70; + Thu, 7 Jul 2005 15:52:34 +0100 (BST) +Message-ID: <42CD41B1.5050003@archonet.com> +Date: Thu, 07 Jul 2005 15:52:33 +0100 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Jean-Max Reymond +Cc: pgsql-performance@postgresql.org +Subject: Re: Surprizing performances for Postgres on Centrino +References: <4b09a0c05070705495df28801@mail.gmail.com> + <20050707140934.GB6139@alvh.no-ip.org> + <4b09a0c050707072372e87ce6@mail.gmail.com> +In-Reply-To: <4b09a0c050707072372e87ce6@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/74 +X-Sequence-Number: 13315 + +Jean-Max Reymond wrote: +> On 7/7/05, Alvaro Herrera wrote: +> +> +>>Do you have the same locale settings on all of them? +>> +> +> +> interressant: +> UNICODE on the fast laptop +> SQL_ASCII on the slowest desktops. +> is UNICODE database faster than SQL_ASCII ? + +That's your encoding (character-set). Locale is something like "C" or +"en_US" or "fr_FR". + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Thu Jul 7 12:07:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 29D7E5288B + for ; + Thu, 7 Jul 2005 12:03:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24868-07 + for ; + Thu, 7 Jul 2005 15:03:42 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) + by svr1.postgresql.org (Postfix) with ESMTP id 3AC4C52A16 + for ; + Thu, 7 Jul 2005 12:03:41 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 70so217248wra + for ; + Thu, 07 Jul 2005 08:03:40 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; + b=Y4ZjKsR6QmfKsZc+jKPdd0ZvOMXX6mGyDP9MwsdFeqTDvLRaw4tiz+dn7vl+rVsirkHFgNxYjKpoH5nVgkHaBGbG3D6W5TYU1zbL6TLcYOzjqrOtPqNy1hq3FHuEOK0BReTHsEt8piIKEzqBlz8Z7L5yYW4dbPnK8GE9vnDDC0c= +Received: by 10.54.26.4 with SMTP id 4mr832288wrz; + Thu, 07 Jul 2005 08:03:40 -0700 (PDT) +Received: from ?10.80.1.45? ([194.248.208.82]) + by mx.gmail.com with ESMTP id 29sm1727248wrl.2005.07.07.08.03.39; + Thu, 07 Jul 2005 08:03:39 -0700 (PDT) +In-Reply-To: <7517.1120744945@sss.pgh.pa.us> +References: <6F239216-7936-4E62-B708-46DC9171649C@gmail.com> + <7517.1120744945@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v728) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: +Cc: Tom Lane +Content-Transfer-Encoding: 7bit +From: Bendik Rognlien Johansen +Subject: Re: How to speed up delete +Date: Thu, 7 Jul 2005 17:03:36 +0200 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.728) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.129 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/75 +X-Sequence-Number: 13316 + +Thanks! +That took care of it. +On Jul 7, 2005, at 4:02 PM, Tom Lane wrote: + +> Bendik Rognlien Johansen writes: +> +>> I am running few of these deletes (could become many more) inside a +>> transaction and each one takes allmost a second to complete. +>> Is it because of the foreign key constraint, or is it something else? +>> +> +> You need an index on "original" to support that FK efficiently. Check +> for references from other tables to this one, too. +> +> regards, tom lane +> + + +From pgsql-performance-owner@postgresql.org Thu Jul 7 19:21:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2714452A03 + for ; + Thu, 7 Jul 2005 19:21:36 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96208-02 + for ; + Thu, 7 Jul 2005 22:21:33 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id E2A5E52965 + for ; + Thu, 7 Jul 2005 19:21:30 -0300 (ADT) +Received: (qmail 2507 invoked from network); 8 Jul 2005 00:21:59 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 8 Jul 2005 00:21:59 +0200 +To: "Madison Kelly" , + pgsql-performance@postgresql.org +Subject: Re: Need suggestion high-level suggestion on how to solve a + performance problem +References: <42CD2A7A.10603@alteeve.com> +Message-ID: +Date: Fri, 08 Jul 2005 00:21:31 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <42CD2A7A.10603@alteeve.com> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/76 +X-Sequence-Number: 13317 + + + Hello, + I once upon a time worked in a company doing backup software and I +remember these problems, we had exactly the same ! + The file tree was all into memory and everytime the user clicked on +something it haaad to update everything. Being C++ it was very fast, but +to backup a million files you needed a gig of RAM, which is... a problem +let's say, when you think my linux laptop has about 400k files on it. + So we rewrote the project entirely with the purpose of doing the million +files thingy with the clunky Pentium 90 with 64 megabytes of RAM, and it +worked. + What I did was this : + - use Berkeley DB + Berkeley DB isn't a database like postgres, it's just a tree, but it's +cool for managing trees. It's quite fast, uses key compression, etc. + It has however a few drawbacks : + - files tend to fragment a lot over time and it can't reindex or vacuum +like postgres. You have to dump and reload. + - the price of the licence to be able to embed it in your product and +sell it is expensive, and if you want crash-proof, it's insanely expensive. + - Even though it's a tree it has no idea what a parent is so you have to +mess with that manually. We used a clever path encoding to keep all the +paths inside the same directory close in the tree ; and separated database +for dirs and files because we wanted the dirs to be in the cache, whereas +we almost never touched the files. + + And... + You can't make it if you update every node everytime the user clicks on +something. You have to update 1 node. + In your tree you have nodes. + Give each node a state being one of these three : include, exclude, +inherit + When you fetch a node you also fetch all of its parents, and you +propagate the state to know the state of the final node. + If a node is in state 'inherit' it is like its parent, etc. + So you have faster updates but slower selects. However, there is a bonus +: if you check a directory as "include" and one of its subdirectory as +"exclude", and the user adds files all over the place, the files added in +the "included" directory will be automatically backed up and the ones in +the 'ignored' directory will be automatically ignored, you have nothing to +change. + And it is not that slow because, if you think about it, suppose you have +/var/www/mysite/blah with 20.000 files in it, in order to inherit the +state of the parents on them you only have to fetch /var once, www once, +etc. + So if you propagate your inherited properties when doing a tree traversal +it comes at no cost. + + IMHO it's the only solution. + + It can be done quite easily also, using ltree types and a little stored +procedures, you can even make a view which gives the state of each +element, computed by inheritance. + + Here's the secret : the user will select 100.000 files by clicking on a +directory near root, but the user will NEVER look at 100.000 files. So you +can make looking at files 10x slower if you can make including/excluding +directories 100.000 times faster. + + Now you'll ask me, but how do I calculate the total size of the backup +without looking at all the files ? when I click on a directory I don't +know what files are in it and which will inherit and which will not. + + It's simple : you precompute it when you scan the disk for changed files. +This is the only time you should do a complete tree exploration. + + On each directory we put a matrix [M]x[N], M and N being one of the three +above state, containing the amount of stuff in the directory which would +be in state M if the directory was in state N. This is very easy to +compute when you scan for new files. Then when a directory changes state, +you have to sum a few cells of that matrix to know how much more that adds +to the backup. And you only look up 1 record. + + Is that helpful ? + + + + + + + + + + + + + + + + +From pgsql-performance-owner@postgresql.org Thu Jul 7 20:29:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 81DA752A20 + for ; + Thu, 7 Jul 2005 20:29:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21938-09 + for ; + Thu, 7 Jul 2005 23:29:32 +0000 (GMT) +Received: from tomts5-srv.bellnexxia.net (tomts5.bellnexxia.net + [209.226.175.25]) + by svr1.postgresql.org (Postfix) with ESMTP id 179FB52815 + for ; + Thu, 7 Jul 2005 20:29:30 -0300 (ADT) +Received: from [192.168.1.99] ([64.229.11.238]) by tomts5-srv.bellnexxia.net + (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP + id <20050707232932.USOW26128.tomts5-srv.bellnexxia.net@[192.168.1.99]>; + Thu, 7 Jul 2005 19:29:32 -0400 +Message-ID: <42CDBAB2.9030406@alteeve.com> +Date: Thu, 07 Jul 2005 19:28:50 -0400 +From: Madison Kelly +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 +X-Accept-Language: en-us, en, ja +MIME-Version: 1.0 +To: PFC +Cc: pgsql-performance@postgresql.org +Subject: Re: Need suggestion high-level suggestion on how to solve +References: <42CD2A7A.10603@alteeve.com> +In-Reply-To: +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/77 +X-Sequence-Number: 13318 + +PFC wrote: +> +> Hello, +> I once upon a time worked in a company doing backup software and I +> remember these problems, we had exactly the same ! + + Prety neat. :) + +> The file tree was all into memory and everytime the user clicked on +> something it haaad to update everything. Being C++ it was very fast, +> but to backup a million files you needed a gig of RAM, which is... a +> problem let's say, when you think my linux laptop has about 400k files +> on it. + + I want this to run on "average" systems (I'm developing it primarily +on my modest P3 1GHz Thinkpad w/ 512MB RAM running Debian) so expecting +that much free memory is not reasonable. As it is my test DB, with a +realistic amount of data, is ~150MB. + +> So we rewrote the project entirely with the purpose of doing the +> million files thingy with the clunky Pentium 90 with 64 megabytes of +> RAM, and it worked. +> What I did was this : +> - use Berkeley DB + +> - the price of the licence to be able to embed it in your product +> and sell it is expensive, and if you want crash-proof, it's insanely +> expensive. + + This is the kicker right there; my program is released under the GPL +so it's fee-free. I can't eat anything costly like that. As it is there +is hundreds and hundreds of hours in this program that I am already +hoping to recoup one day through support contracts. Adding commercial +software I am afraid is not an option. + +> bonus : if you check a directory as "include" and one of its +> subdirectory as "exclude", and the user adds files all over the place, +> the files added in the "included" directory will be automatically +> backed up and the ones in the 'ignored' directory will be automatically +> ignored, you have nothing to change. + +> IMHO it's the only solution. + + Now *this* is an idea worth looking into. How I will implement it +with my system I don't know yet but it's a new line of thinking. Wonderful! + +> Now you'll ask me, but how do I calculate the total size of the +> backup without looking at all the files ? when I click on a directory I +> don't know what files are in it and which will inherit and which will not. +> +> It's simple : you precompute it when you scan the disk for changed +> files. This is the only time you should do a complete tree exploration. + + This is already what I do. When a user selects a partition they want +to select files to backup or restore the partition is scanned. The scan +looks at every file, directory and symlink and records it's size (on +disk), it mtime, owner, group, etc. and records it to the database. I've +got this scan/update running at ~1,500 files/second on my laptop. That +was actually the first performance tuning I started with. :) + + With all the data in the DB the backup script can calculate rather +intelligently where it wants to copy each directory to. + +> On each directory we put a matrix [M]x[N], M and N being one of the +> three above state, containing the amount of stuff in the directory +> which would be in state M if the directory was in state N. This is very +> easy to compute when you scan for new files. Then when a directory +> changes state, you have to sum a few cells of that matrix to know how +> much more that adds to the backup. And you only look up 1 record. + + In my case what I do is calculate the size of all the files selected +for backup in each directory, sort the directories from all sources by +the total size of all their selected files and then start assigning the +directories, largest to smallest to each of my available destination +medias. If it runs out of destination space it backs up what it can and +then waits a user-definable amount of time and then checks to see if any +new destination media has been made available. If so it again tries to +assign the files/directories that didn't fit. It will loop a +user-definable number of times before giving up and warning the user +that more destination space is needed for that backup job. + +> Is that helpful ? + + The three states (inhertied, backup, ignore) has definately caught my +attention. Thank you very much for your idea and lengthy reply! + +Madison + +From pgsql-performance-owner@postgresql.org Thu Jul 7 20:58:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A412052A72 + for ; + Thu, 7 Jul 2005 20:58:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24193-05 + for ; + Thu, 7 Jul 2005 23:58:44 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 35AEC52A6E + for ; + Thu, 7 Jul 2005 20:58:43 -0300 (ADT) +Received: (qmail 7364 invoked from network); 8 Jul 2005 01:59:14 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 8 Jul 2005 01:59:14 +0200 +To: "Madison Kelly" +Cc: pgsql-performance@postgresql.org +Subject: Re: Need suggestion high-level suggestion on how to solve a + performance problem +References: <42CD2A7A.10603@alteeve.com> + <42CDBAB2.9030406@alteeve.com> +Message-ID: +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Date: Fri, 08 Jul 2005 01:58:46 +0200 +In-Reply-To: <42CDBAB2.9030406@alteeve.com> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/78 +X-Sequence-Number: 13319 + + + +> This is the kicker right there; my program is released under the GPL +> so it's fee-free. I can't eat anything costly like that. As it is there +> is hundreds and hundreds of hours in this program that I am already +> hoping to recoup one day through support contracts. Adding commercial +> software I am afraid is not an option. + + If you open-source GPL then Berkeley is free for you. + +From pgsql-performance-owner@postgresql.org Thu Jul 7 22:02:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 04102529EE + for ; + Thu, 7 Jul 2005 22:02:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38007-09 + for ; + Fri, 8 Jul 2005 01:02:10 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 924E9529E5 + for ; + Thu, 7 Jul 2005 22:02:09 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7584349; Thu, 07 Jul 2005 18:04:22 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Madison Kelly +Subject: Re: Need suggestion high-level suggestion on how to solve a + performance problem +Date: Thu, 7 Jul 2005 18:04:28 -0700 +User-Agent: KMail/1.8 +Cc: pgsql-performance@postgresql.org +References: <42CD2A7A.10603@alteeve.com> +In-Reply-To: <42CD2A7A.10603@alteeve.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +Message-Id: <200507071804.29189.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/79 +X-Sequence-Number: 13320 + +Madison, + +> =A0 =A0The problem comes when the user toggles a directory branch's backup +> flag (a simple check box beside the directory name). If it's a directory +> near the end of a branch it is fast enough. If they toggle a single file +> it is nearly instant. However if they toggle say the root directory, so +> every file and directory below it needs to be updated, it can take +> 500-600sec to return. Obviously this is no good. +> +> =A0 =A0What I need is a scheme for being able to say, essentially: +> +> UPDATE file_info_1 SET file_backup=3D't' WHERE file_parent_dir~'^/'; + +Well, from the sound of it the problem is not selecting the files to be=20 +updated, it's updating them. =20 + +What I would do, personally, is *not* store an update flag for each file. = +=20 +Instead, I would store the update flag for the directory which was=20 +selected. If users want to exclude certain files and subdirectories, I'd=20 +also include a dont_update flag. When it's time to back up, you simply=20 +check the tree for the most immediate update or don't update flag above=20 +each file. + +=46or the table itself, I'd consider using ltree for the directory tree=20 +structure. It has some nice features which makes it siginifcanly better=20 +than using a delimited text field. + +=2D-=20 +=2D-Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Jul 7 22:33:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EE0E352965 + for ; + Thu, 7 Jul 2005 22:33:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47651-02 + for ; + Fri, 8 Jul 2005 01:32:56 +0000 (GMT) +Received: from mail.iinet.net.au (mail-08.iinet.net.au [203.59.3.40]) + by svr1.postgresql.org (Postfix) with SMTP id 55DBD52A08 + for ; + Thu, 7 Jul 2005 22:32:54 -0300 (ADT) +Received: (qmail 19059 invoked from network); 8 Jul 2005 01:32:51 -0000 +Received: from unknown (HELO localhost.localdomain) (203.217.37.199) + by mail.iinet.net.au with SMTP; 8 Jul 2005 01:32:51 -0000 +Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) + by localhost.localdomain (Postfix) with ESMTP id 6349D14359; + Fri, 8 Jul 2005 11:32:46 +1000 (EST) +Message-ID: <42CDD7B8.6050109@stuartbishop.net> +Date: Fri, 08 Jul 2005 11:32:40 +1000 +From: Stuart Bishop +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Mount database on RAM disk? +X-Enigmail-Version: 0.90.2.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigEBFE01B41C91D1AD1C2DFB6D" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.137 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/80 +X-Sequence-Number: 13321 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigEBFE01B41C91D1AD1C2DFB6D +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 7bit + + +I'm putting together a road map on how our systems can scale as our load +increases. As part of this, I need to look into setting up some fast read +only mirrors of our database. We should have more than enough RAM to fit +everything into memory. I would like to find out if I could expect better +performance by mounting the database from a RAM disk, or if I would be +better off keeping that RAM free and increasing the effective_cache_size +appropriately. + +I'd also be interested in knowing if this is dependant on whether I am +running 7.4, 8.0 or 8.1. + + +-- +Stuart Bishop +http://www.stuartbishop.net/ + +--------------enigEBFE01B41C91D1AD1C2DFB6D +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.5 (GNU/Linux) + +iD8DBQFCzde9AfqZj7rGN0oRAi34AJ9PMD44LBvppopJLYz+BL19HWGb+wCgkmsO +g0oTZpwKfU+yRowWeExNv+w= +=3Du5 +-----END PGP SIGNATURE----- + +--------------enigEBFE01B41C91D1AD1C2DFB6D-- + +From pgsql-performance-owner@postgresql.org Fri Jul 8 00:05:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 32B2252A37 + for ; + Fri, 8 Jul 2005 00:05:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65031-07 + for ; + Fri, 8 Jul 2005 03:05:30 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 5BC7E52A01 + for ; + Fri, 8 Jul 2005 00:05:29 -0300 (ADT) +Received: from [192.168.1.100] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j6835SoQ020507; Thu, 7 Jul 2005 20:05:29 -0700 +Message-ID: <42CDED86.3000108@commandprompt.com> +Date: Thu, 07 Jul 2005 20:05:42 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Stuart Bishop +Cc: pgsql-performance@postgresql.org +Subject: Re: Mount database on RAM disk? +References: <42CDD7B8.6050109@stuartbishop.net> +In-Reply-To: <42CDD7B8.6050109@stuartbishop.net> +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/81 +X-Sequence-Number: 13322 + +Stuart Bishop wrote: +> I'm putting together a road map on how our systems can scale as our load +> increases. As part of this, I need to look into setting up some fast read +> only mirrors of our database. We should have more than enough RAM to fit +> everything into memory. I would like to find out if I could expect better +> performance by mounting the database from a RAM disk, or if I would be +> better off keeping that RAM free and increasing the effective_cache_size +> appropriately. + +In theory yes if you can fit the entire database onto a ram disk then +you would see a performance benefit. + +Sincerely, + +Joshua D. Drake + + +> +> I'd also be interested in knowing if this is dependant on whether I am +> running 7.4, 8.0 or 8.1. +> +> + + +-- +Your PostgreSQL solutions provider, Command Prompt, Inc. +24x7 support - 1.800.492.2240, programming, and consulting +Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit +http://www.commandprompt.com / http://www.postgresql.org + +From pgsql-performance-owner@postgresql.org Fri Jul 8 01:04:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 48D38529C8 + for ; + Fri, 8 Jul 2005 01:04:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42325-04 + for ; + Fri, 8 Jul 2005 04:04:10 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 7473C52858 + for ; + Fri, 8 Jul 2005 01:04:08 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 240AB30B41; Fri, 8 Jul 2005 06:08:07 +0200 (MET DST) +From: Chris Browne +X-Newsgroups: pgsql.performance +Subject: Re: Mount database on RAM disk? +Date: Thu, 07 Jul 2005 23:30:09 -0400 +Organization: cbbrowne Computing Inc +Lines: 30 +Message-ID: <60zmsykm9q.fsf@dba2.int.libertyrms.com> +References: <42CDD7B8.6050109@stuartbishop.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (Jumbo Shrimp, linux) +Cancel-Lock: sha1:WI0k/qpXJjfTMWU2RHxH3a6FG8A= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.136 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/82 +X-Sequence-Number: 13323 + +stuart@stuartbishop.net (Stuart Bishop) writes: +> I'm putting together a road map on how our systems can scale as our +> load increases. As part of this, I need to look into setting up some +> fast read only mirrors of our database. We should have more than +> enough RAM to fit everything into memory. I would like to find out +> if I could expect better performance by mounting the database from a +> RAM disk, or if I would be better off keeping that RAM free and +> increasing the effective_cache_size appropriately. + +If you were willing to take on a not-inconsiderable risk, I'd think +that storing WAL files on a RAMDISK would be likely to be the fastest +improvement imaginable. + +If I could get and deploy some SSD (Solid State Disk) devices that +would make this sort of thing *actually safe,* I'd expect that to be a +pretty fabulous improvement, at least for write-heavy database +activity. + +> I'd also be interested in knowing if this is dependant on whether I +> am running 7.4, 8.0 or 8.1. + +Behaviour of all three could be somewhat different, as management of +the shared cache has been in flux... +-- +(format nil "~S@~S" "cbbrowne" "acm.org") +http://www.ntlug.org/~cbbrowne/sap.html +Rules of the Evil Overlord #78. "I will not tell my Legions of Terror +"And he must be taken alive!" The command will be: ``And try to take +him alive if it is reasonably practical.''" + + +From pgsql-performance-owner@postgresql.org Fri Jul 8 11:47:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 52674529D7 + for ; + Fri, 8 Jul 2005 11:47:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45239-10 + for ; + Fri, 8 Jul 2005 14:47:36 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 9BD785281A + for ; + Fri, 8 Jul 2005 11:47:34 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j68DkdWK008133 + for pgsql-performance@postgresql.org; Fri, 8 Jul 2005 15:46:39 +0200 +Date: Fri, 8 Jul 2005 15:46:39 +0200 +From: Enrico Weigelt +To: postgresql performance list +Subject: Re: plain inserts and deletes very slow +Message-ID: <20050708134638.GA6368@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: postgresql performance list + +References: <42C8B23F.4000400@telogis.com> + <20050704085903.GG9777@nibiru.borg.metux.de> + <42C9C7E278.E5BFKG@129.180.47.120> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42C9C7E278.E5BFKG@129.180.47.120> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/84 +X-Sequence-Number: 13325 + +* Klint Gore wrote: + + + +> Turn on statement logging. I've seen delphi interfaces do extra queries +> on system tables to find some structure information. + +I'm already using statement logging of all queries taking longer +than 200ms. It seems that only the INSERT takes such a time. + +The client is in fact written in delphi, and it sometimes seems +to do strange things. For example we had the effect, that some +new fields in some table were regularily NULL'ed. None of the +triggers and rules inside the DB could do that (since there's +no dynamic query stuff) and the delphi application is the only +one writing directly to this table. + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de +--------------------------------------------------------------------- + Realtime Forex/Stock Exchange trading powered by postgresSQL :)) + http://www.fxignal.net/ +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Fri Jul 8 12:01:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 22BB652A79 + for ; + Fri, 8 Jul 2005 12:01:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51557-09 + for ; + Fri, 8 Jul 2005 15:01:28 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id E372E52A62 + for ; + Fri, 8 Jul 2005 12:01:26 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j68E0Pw8009760; + Fri, 8 Jul 2005 16:00:25 +0200 +Date: Fri, 8 Jul 2005 16:00:24 +0200 +From: Enrico Weigelt +To: pgsql-performance@postgresql.org +Cc: Bruno Wolff III , + mark durrant +Subject: Re: Select performance vs. mssql +Message-ID: <20050708140024.GB6368@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: pgsql-performance@postgresql.org, + Bruno Wolff III , mark durrant +References: <20050524153637.64525.qmail@web53101.mail.yahoo.com> + <20050524172713.GC8129@wolff.to> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050524172713.GC8129@wolff.to> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/85 +X-Sequence-Number: 13326 + +* Bruno Wolff III wrote: + + + +> This gets brought up a lot. The problem is that the index doesn't include +> information about whether the current transaction can see the referenced +> row. Putting this information in the index will add significant overhead +> to every update and the opinion of the developers is that this would be +> a net loss overall. + +wouldn't it work well to make this feature optionally for each +index ? There could be some flag on the index (ie set at create +time) which tells postgres whether to store mvcc information. + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de +--------------------------------------------------------------------- + Realtime Forex/Stock Exchange trading powered by postgresSQL :)) + http://www.fxignal.net/ +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Fri Jul 8 11:07:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6332E52A0E + for ; + Fri, 8 Jul 2005 11:07:08 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31283-06 + for ; + Fri, 8 Jul 2005 14:06:59 +0000 (GMT) +Received: from gatekeeper.look.ca (gamma1.look.ca [207.136.80.8]) + by svr1.postgresql.org (Postfix) with ESMTP id 023CC52815 + for ; + Fri, 8 Jul 2005 11:06:57 -0300 (ADT) +Received: from 216-154-13-109.dsl.look.ca ([216.154.13.109]) + by gatekeeper.look.ca with esmtp (Exim 4.20) + id 1DqtVN-0006ld-2d; Fri, 08 Jul 2005 14:07:01 +0000 +From: Rod Taylor +To: Chris Browne +Cc: pgsql-performance@postgresql.org +In-Reply-To: <60zmsykm9q.fsf@dba2.int.libertyrms.com> +References: <42CDD7B8.6050109@stuartbishop.net> + <60zmsykm9q.fsf@dba2.int.libertyrms.com> +Date: Fri, 08 Jul 2005 10:03:48 -0400 +Message-Id: <1120831428.24708.228.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.3 FreeBSD GNOME Team Port +X-SA-Exim-Mail-From: pg@rbt.ca +Subject: Re: Mount database on RAM disk? +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +X-SA-Exim-Version: 3.1 (built Tue Feb 24 05:09:27 GMT 2004) +X-SA-Exim-Scanned: Yes +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.035 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/83 +X-Sequence-Number: 13324 + +> If I could get and deploy some SSD (Solid State Disk) devices that +> would make this sort of thing *actually safe,* I'd expect that to be a +> pretty fabulous improvement, at least for write-heavy database +> activity. + +Not nearly as much as you would expect. For the price of the SSD and a +SCSI controller capable of keeping up to the SSD along with your regular +storage with enough throughput to keep up to structure IO, you can +purchase a pretty good mid-range SAN which will be just as capable and +much more versatile. + +-- + + +From pgsql-performance-owner@postgresql.org Fri Jul 8 12:44:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B620A52AD6 + for ; + Fri, 8 Jul 2005 12:44:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27159-01 + for ; + Fri, 8 Jul 2005 15:44:42 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E00452AD9 + for ; + Fri, 8 Jul 2005 12:44:37 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j68Ehbb2017967 + for pgsql-performance@postgresql.org; Fri, 8 Jul 2005 16:43:37 +0200 +Date: Fri, 8 Jul 2005 16:43:36 +0200 +From: Enrico Weigelt +To: pgsql-performance@postgresql.org +Subject: Re: Need help to decide Mysql vs Postgres +Message-ID: <20050708144336.GC6368@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: pgsql-performance@postgresql.org +References: <001c01c56acb$bc9ba730$797ba8c0@jfradkin> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/86 +X-Sequence-Number: 13327 + +* PFC wrote: + + +> For Python it's the reverse : the MySQL driver is slow and dumb, +> and the postgres driver (psycopg 2) is super fast, handles all quoting, +> and knows about type conversions, it will automatically convert a +> Python List into a postgres Array and do the right thing with quoting, +> and it works both ways (ie you select a TEXT[] you get a list of +> strings all parsed for you). It knows about all the postgres types (yes +> even numeric <=> python Decimal) and you can even add your own types. +> That's really cool, plus the developer is a friendly guy. + +Is there anything similar for java ? + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de +--------------------------------------------------------------------- + Realtime Forex/Stock Exchange trading powered by postgresSQL :)) + http://www.fxignal.net/ +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Fri Jul 8 13:37:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4E3A652ADD + for ; + Fri, 8 Jul 2005 13:37:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 98202-02 + for ; + Fri, 8 Jul 2005 16:37:46 +0000 (GMT) +Received: from metux.de (seven.metux.de [193.16.1.1]) + by svr1.postgresql.org (Postfix) with ESMTP id BF5B652A98 + for ; + Fri, 8 Jul 2005 13:37:41 -0300 (ADT) +Received: (from weigelt@localhost) + by metux.de (8.12.10/8.12.10) id j68FacK8027693 + for pgsql-performance@postgresql.org; Fri, 8 Jul 2005 17:36:38 +0200 +Date: Fri, 8 Jul 2005 17:36:38 +0200 +From: Enrico Weigelt +To: pgsql-performance@postgresql.org +Subject: Re: Why the planner is not using the INDEX . +Message-ID: <20050708153638.GD6368@nibiru.borg.metux.de> +Reply-To: weigelt@metux.de +Mail-Followup-To: pgsql-performance@postgresql.org +References: <20050630222451.GA17628@calvin.surfutopia.net> + <42C473BA.9090305@commandprompt.com> + <20050630235821.GA2163@calvin.surfutopia.net> + <42C994BD.3000909@siunik.com> <23492.1120579796@sss.pgh.pa.us> + <42CAC937.4080702@siunik.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42CAC937.4080702@siunik.com> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.107 tagged_above=0 required=5 tests=AWL, + UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200507/90 +X-Sequence-Number: 13331 + +* David Gagnon wrote: + +> FOR inventoryTransaction IN +> SELECT DISTINCT IRNUM, IRAENUM, IRSTATUT, IRSENS, IRSOURCE, +> IRDATE, IRQTE +> FROM IR +> WHERE IRNUM = ANY (requestIds) and IRYPNUM = companyId +> LOOP + +hmm. you probably could create the query dynamically and +then execute it. + + +BTW: why isn't IN not usable with arrays ? + + +cu +-- +--------------------------------------------------------------------- + Enrico Weigelt == metux IT service + phone: +49 36207 519931 www: http://www.metux.de/ + fax: +49 36207 519932 email: contact@metux.de +--------------------------------------------------------------------- + Realtime Forex/Stock Exchange trading powered by postgresSQL :)) + http://www.fxignal.net/ +--------------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Fri Jul 8 13:08:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2B46752AD7 + for ; + Fri, 8 Jul 2005 13:08:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91877-03 + for ; + Fri, 8 Jul 2005 16:08:22 +0000 (GMT) +Received: from mir3-fs.mir3.com (www.mir3.com [216.74.11.46]) + by svr1.postgresql.org (Postfix) with ESMTP id 9823B52AF6 + for ; + Fri, 8 Jul 2005 13:08:14 -0300 (ADT) +Received: from archimedes.mirlogic.com ([172.16.2.68]) by mir3-fs.mir3.com + with Microsoft SMTPSVC(5.0.2195.6713); + Fri, 8 Jul 2005 09:11:03 -0700 +Subject: Re: Need help to decide Mysql vs Postgres +From: Mark Lewis +To: weigelt@metux.de +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20050708144336.GC6368@nibiru.borg.metux.de> +References: <001c01c56acb$bc9ba730$797ba8c0@jfradkin> + + <20050708144336.GC6368@nibiru.borg.metux.de> +Content-Type: text/plain +Organization: MIR3, Inc. +Date: Fri, 08 Jul 2005 09:08:10 -0700 +Message-Id: <1120838891.3326.79.camel@archimedes.mirlogic.com> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-16) +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 08 Jul 2005 16:11:03.0109 (UTC) + FILETIME=[A3506750:01C583D7] +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200507/87 +X-Sequence-Number: 13328 + +On Fri, 2005-07-08 at 16:43 +0200, Enrico Weigelt wrote: +> * PFC wrote: +> +> +> > For Python it's the reverse : the MySQL driver is slow and dumb, +> > and the postgres driver (psycopg 2) is super fast, handles all quoting, +> > and knows about type conversions, it will automatically convert a +> > Python List into a postgres Array and do the right thing with quoting, +> > and it works both ways (ie you select a TEXT[] you get a list of +> > strings all parsed for you). It knows about all the postgres types (yes +> > even numeric <=> python Decimal) and you can even add your own types. +> > That's really cool, plus the developer is a friendly guy. +> +> Is there anything similar for java ? +> + +The postgres JDBC driver is very good-- refer to pgsql-jdbc mailing list +or look at jdbc.postgresql.org. I've had only limited experience with +the mysql jdbc driver, but it seemed servicable enough, if you can live +with their licensing and feature set. + + + + +From pgsql-performance-owner@postgresql.org Fri Jul 8 13:23:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EEF7452A72 + for ; + Fri, 8 Jul 2005 13:23:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94739-07 + for ; + Fri, 8 Jul 2005 16:23:04 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) + by svr1.postgresql.org (Postfix) with ESMTP id 78F7852A26 + for ; + Fri, 8 Jul 2005 13:23:03 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i31so456845wra + for ; + Fri, 08 Jul 2005 09:23:03 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=Dw3ZQKAKAna4HtrkGP05mcCztrJRoCd+RMZoZ4fYMmOYSSuskfqLdZemev7ZiROYBncrkE6ENsH4clIE7lAy6eANJItxrRVa0qtXKKLB6mOp7Ns5Ve/V+VV25yxbJ2te6xDO4fwc51u2oZxzH5uR4TODh1LFiSK4pWhO6vJPe/I= +Received: by 10.54.16.77 with SMTP id 77mr300612wrp; + Fri, 08 Jul 2005 09:22:38 -0700 (PDT) +Received: by 10.54.30.27 with HTTP; Fri, 8 Jul 2005 09:22:38 -0700 (PDT) +Message-ID: <5db591c00507080922236f9192@mail.gmail.com> +Date: Fri, 8 Jul 2005 11:22:38 -0500 +From: Moises Alberto Lindo Gutarra +Reply-To: Moises Alberto Lindo Gutarra +To: weigelt@metux.de, pgsql-performance@postgresql.org +Subject: Re: Need help to decide Mysql vs Postgres +In-Reply-To: <1120838891.3326.79.camel@archimedes.mirlogic.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <001c01c56acb$bc9ba730$797ba8c0@jfradkin> + + <20050708144336.GC6368@nibiru.borg.metux.de> + <1120838891.3326.79.camel@archimedes.mirlogic.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.007 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP, + RCVD_IN_BL_SPAMCOP_NET +X-Spam-Level: * +X-Archive-Number: 200507/88 +X-Sequence-Number: 13329 + +Linux(Debian) + Java + PostgreSQL =3D Fastest + +2005/7/8, Mark Lewis : +> On Fri, 2005-07-08 at 16:43 +0200, Enrico Weigelt wrote: +> > * PFC wrote: +> > +> > +> > > For Python it's the reverse : the MySQL driver is slow and dumb, +> > > and the postgres driver (psycopg 2) is super fast, handles all q= +uoting, +> > > and knows about type conversions, it will automatically convert a +> > > Python List into a postgres Array and do the right thing with quotin= +g, +> > > and it works both ways (ie you select a TEXT[] you get a list of +> > > strings all parsed for you). It knows about all the postgres types (= +yes +> > > even numeric <=3D> python Decimal) and you can even add your own typ= +es. +> > > That's really cool, plus the developer is a friendly guy. +> > +> > Is there anything similar for java ? +> > +>=20 +> The postgres JDBC driver is very good-- refer to pgsql-jdbc mailing list +> or look at jdbc.postgresql.org. I've had only limited experience with +> the mysql jdbc driver, but it seemed servicable enough, if you can live +> with their licensing and feature set. +>=20 +>=20 +>=20 +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: don't forget to increase your free space map settings +>=20 + + +--=20 +Atte + +Moises Alberto Lindo Gutarra +Consultor y Desarrollador Java / Open Source +TUMI Solutions SAC +Tel: +51.13481104 +Cel: +51.197366260=20 +MSN : mlindo@tumisolutions.com + +From pgsql-performance-owner@postgresql.org Fri Jul 8 13:25:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5E70152990 + for ; + Fri, 8 Jul 2005 13:25:08 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94717-09 + for ; + Fri, 8 Jul 2005 16:25:05 +0000 (GMT) +Received: from mailhost.intellivid.com (mailhost.intellivid.com + [64.32.200.11]) + by svr1.postgresql.org (Postfix) with ESMTP id 0CEEE52A0E + for ; + Fri, 8 Jul 2005 13:25:03 -0300 (ADT) +Received: from [192.168.2.68] (spectre.intellivid.com [192.168.2.68]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (Client did not present a certificate) + by newmail.intellivid.com (Postfix) with ESMTP id D68D4F1829D + for ; + Fri, 8 Jul 2005 12:25:02 -0400 (EDT) +Subject: cost-based vacuum +From: Ian Westmacott +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Organization: Intellivid Corp. +Message-Id: <1120839902.20657.197.camel@spectre.intellivid.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 +Date: Fri, 08 Jul 2005 12:25:02 -0400 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/89 +X-Sequence-Number: 13330 + +I am beginning to look at Postgres 8, and am particularly +interested in cost-based vacuum/analyze. I'm hoping someone +can shed some light on the behavior I am seeing. + +Suppose there are three threads: + +writer_thread + every 1/15 second do + BEGIN TRANSACTION + COPY table1 FROM stdin + ... + COPY tableN FROM stdin + perform several UPDATEs, DELETEs and INSERTs + COMMIT + +reader_thread + every 1/15 second do + BEGIN TRANSACTION + SELECT FROM table1 ... + ... + SELECT FROM tableN ... + COMMIT + +analyze_thread + every 5 minutes do + ANALYZE table1 + ... + ANALYZE tableN + + +Now, Postgres 8.0.3 out-of-the-box (all default configs) on a +particular piece of hardware runs the Postgres connection for +writer_thread at about 15% CPU (meaningless, I know, but for +comparison) and runs the Postgres connection for reader_thread +at about 30% CPU. Latency for reader_thread seeing updates +from writer_thread is well under 1/15s. Impact of +analyze_thread is negligible. + +If I make the single configuration change of setting +vacuum_cost_delay=1000, each iteration in analyze_thread takes +much longer, of course. But what I also see is that the CPU +usage of the connections for writer_thread and reader_thread +spike up to well over 80% each (this is a dualie) and latency +drops to 8-10s, during the ANALYZEs. + +I don't understand why this would be. I don't think there +are any lock issues, and I don't see any obvious I/O issues. +Am I missing something? Is there any way to get some +insight into what those connections are doing? + +Thanks, + + --Ian + + + +From pgsql-performance-owner@postgresql.org Fri Jul 8 14:19:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DB96F52ADA + for ; + Fri, 8 Jul 2005 14:19:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44635-05 + for ; + Fri, 8 Jul 2005 17:19:49 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id C162152ABD + for ; + Fri, 8 Jul 2005 14:19:43 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7586968; Fri, 08 Jul 2005 10:21:54 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Mount database on RAM disk? +Date: Fri, 8 Jul 2005 10:22:01 -0700 +User-Agent: KMail/1.8 +Cc: Stuart Bishop +References: <42CDD7B8.6050109@stuartbishop.net> +In-Reply-To: <42CDD7B8.6050109@stuartbishop.net> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200507081022.01680.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/91 +X-Sequence-Number: 13332 + +Stuart, + +> I'm putting together a road map on how our systems can scale as our load +> increases. As part of this, I need to look into setting up some fast +> read only mirrors of our database. We should have more than enough RAM +> to fit everything into memory. I would like to find out if I could +> expect better performance by mounting the database from a RAM disk, or +> if I would be better off keeping that RAM free and increasing the +> effective_cache_size appropriately. + +If you're accessing a dedicated, read-only system with a database small +enough to fit in RAM, it'll all be cached there anyway, at least on Linux +and BSD. You won't be gaining anything by creating a ramdisk. + +BTW, effective_cache_size doesn't determine the amount of caching done. It +just informs the planner about how much db is likely to be cached. The +actual caching is up to the OS/filesystem. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Jul 8 14:48:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3BF5752A99 + for ; + Fri, 8 Jul 2005 14:48:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58872-09 + for ; + Fri, 8 Jul 2005 17:48:24 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DD48852A79 + for ; + Fri, 8 Jul 2005 14:48:23 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j68HmMi8024554; + Fri, 8 Jul 2005 13:48:22 -0400 (EDT) +To: Ian Westmacott +Cc: pgsql-performance@postgresql.org +Subject: Re: cost-based vacuum +In-reply-to: <1120839902.20657.197.camel@spectre.intellivid.com> +References: <1120839902.20657.197.camel@spectre.intellivid.com> +Comments: In-reply-to Ian Westmacott + message dated "Fri, 08 Jul 2005 12:25:02 -0400" +Date: Fri, 08 Jul 2005 13:48:22 -0400 +Message-ID: <24553.1120844902@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/92 +X-Sequence-Number: 13333 + +Ian Westmacott writes: +> If I make the single configuration change of setting +> vacuum_cost_delay=1000, each iteration in analyze_thread takes +> much longer, of course. But what I also see is that the CPU +> usage of the connections for writer_thread and reader_thread +> spike up to well over 80% each (this is a dualie) and latency +> drops to 8-10s, during the ANALYZEs. + +[ scratches head... ] That doesn't make any sense at all. + +> I don't understand why this would be. I don't think there +> are any lock issues, and I don't see any obvious I/O issues. +> Am I missing something? Is there any way to get some +> insight into what those connections are doing? + +Profiling maybe? Can you put together a self-contained test case +that replicates this behavior, so other people could look? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jul 8 16:21:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4D3FD52AEA + for ; + Fri, 8 Jul 2005 16:21:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80632-06 + for ; + Fri, 8 Jul 2005 19:21:23 +0000 (GMT) +Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) + by svr1.postgresql.org (Postfix) with ESMTP id B46A25282F + for ; + Fri, 8 Jul 2005 16:21:21 -0300 (ADT) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="US-ASCII" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Mount database on RAM disk? +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Date: Fri, 8 Jul 2005 15:21:21 -0400 +Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2CFE@Herge.rcsinc.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Mount database on RAM disk? +Thread-Index: AcWD4ZHX+xf/FouUSYSUAOgtXWoebQAD8weg +From: "Merlin Moncure" +To: +Cc: "Stuart Bishop" , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/93 +X-Sequence-Number: 13334 + +> Stuart, +>=20 +> > I'm putting together a road map on how our systems can scale as our +load +> > increases. As part of this, I need to look into setting up some fast +> > read only mirrors of our database. We should have more than enough +RAM +> > to fit everything into memory. I would like to find out if I could +> > expect better performance by mounting the database from a RAM disk, +or +> > if I would be better off keeping that RAM free and increasing the +> > effective_cache_size appropriately. +>=20 +> If you're accessing a dedicated, read-only system with a database +small +> enough to fit in RAM, it'll all be cached there anyway, at least on +Linux +> and BSD. You won't be gaining anything by creating a ramdisk. + + +=20 +ditto windows. =20 + +Files cached in memory are slower than reading straight from memory but +not nearly enough to justify reserving memory for your use. In other +words, your O/S is a machine with years and years of engineering +designed best how to dole memory out to caching and various processes. +Why second guess it? + +Merlin + +From pgsql-performance-owner@postgresql.org Fri Jul 8 18:47:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5615F52AF2 + for ; + Fri, 8 Jul 2005 18:47:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68888-09 + for ; + Fri, 8 Jul 2005 21:47:31 +0000 (GMT) +Received: from mailservice.tudelft.nl (mailservice.tudelft.nl [130.161.131.5]) + by svr1.postgresql.org (Postfix) with ESMTP id 65DA552AF7 + for ; + Fri, 8 Jul 2005 18:47:30 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by rav.antivirus (Postfix) with ESMTP id 3EB6E22F1A8 + for ; + Fri, 8 Jul 2005 23:47:32 +0200 (CEST) +Received: from [145.94.90.156] (jochemd.tnw-s.tudelft.nl [145.94.90.156]) + by mx1.tudelft.nl (Postfix) with ESMTP id 9595D22F16F + for ; + Fri, 8 Jul 2005 23:47:30 +0200 (CEST) +Message-ID: <42CEF46F.4060308@oli.tudelft.nl> +Date: Fri, 08 Jul 2005 23:47:27 +0200 +From: Jochem van Dieten +Organization: OnLine Internet +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Select performance vs. mssql +References: <20050708140024.GB6368@nibiru.borg.metux.de> +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at tudelft.nl +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/94 +X-Sequence-Number: 13335 + +Enrico Weigelt wrote: +> Bruno Wolff III wrote: +>> +>> This gets brought up a lot. The problem is that the index doesn't include +>> information about whether the current transaction can see the referenced +>> row. Putting this information in the index will add significant overhead +>> to every update and the opinion of the developers is that this would be +>> a net loss overall. +> +> wouldn't it work well to make this feature optionally for each +> index ? There could be some flag on the index (ie set at create +> time) which tells postgres whether to store mvcc information. + +There is no reason to assume it can't work. + +There is little reason to assume that it will be the best +solution in many circumstances. + +There is a big reason why people are sceptical: there is no patch. + + +The issue has been debated and beaten to death. People have +formed their opinions and are unlikely to change their position. +If you want to convince people, your best bet is to submit a +patch and have OSDL measure the performance improvement. + +Jochem + + +From pgsql-performance-owner@postgresql.org Fri Jul 8 20:57:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5D32C52AF8 + for ; + Fri, 8 Jul 2005 20:57:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07592-07 + for ; + Fri, 8 Jul 2005 23:57:06 +0000 (GMT) +Received: from wsmailap01.firstam.com (outbound-smtp01.firstam.com + [208.246.101.197]) + by svr1.postgresql.org (Postfix) with ESMTP id DC7FA5282F + for ; + Fri, 8 Jul 2005 20:57:01 -0300 (ADT) +Received: from 172.21.131.5 by wsmailap01.firstam.com with ESMTP ( + Tumbleweed MMS SMTP Relay (MMS v5.6.3)); Fri, 08 Jul 2005 16:56:52 + -0700 +X-Server-Uuid: 2A3A6F04-3324-429D-9DE4-35238E3EA19C +Received: from anammx01.ana.firstamdata.com ([192.168.173.35]) by + famarp01.firstam.com (MOS 3.5.6-GR) with SMTP id EBG53698; Fri, 8 Jul + 2005 16:56:54 -0700 (PDT) +Received: from pisgana01sxch21.ana.firstamdata.com (Not + Verified[192.168.173.71]) by mailgateway.firstam.com (post.office MTA + v5.0 0924 ) with ESMTP id ; Fri, 08 Jul 2005 16:56:54 -0700 +Received: from pisgana01sxch01.ana.firstamdata.com ([192.168.173.70]) by + pisgana01sxch21.ana.firstamdata.com with Microsoft SMTPSVC(6.0.3790.211 + ); Fri, 8 Jul 2005 16:56:54 -0700 +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: How to revoke a password +Date: Fri, 8 Jul 2005 16:56:53 -0700 +Message-ID: + +Thread-Topic: How to revoke a password +Thread-Index: AcWEGLckZtmr1XeqTb6IvNYHSkBD6w== +From: "Bailey, Larry" +To: pgsql-performance@postgresql.org +X-OriginalArrivalTime: 08 Jul 2005 23:56:54.0221 (UTC) + FILETIME=[B7799FD0:01C58418] +X-WSS-ID: 6ED1CD4E1GS114755-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/95 +X-Sequence-Number: 13336 + +I created a user with a password. That newly created user now have +tables and indexes. I want to ALTER that user to exclude the password. +How is this accomplished without dropping and recreating the users? + +Larry Bailey +Sr. Oracle DBA +First American Real Estate Solution +(714) 701-3347 +lbailey@firstam.com=20 +********************************************************************** +This message contains confidential information intended only for the=20 +use of the addressee(s) named above and may contain information that=20 +is legally privileged. If you are not the addressee, or the person=20 +responsible for delivering it to the addressee, you are hereby=20 +notified that reading, disseminating, distributing or copying this=20 +message is strictly prohibited. If you have received this message by=20 +mistake, please immediately notify us by replying to the message and=20 +delete the original message immediately thereafter. + +Thank you. FADLD Tag +********************************************************************** + + +From pgsql-performance-owner@postgresql.org Fri Jul 8 21:09:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E06D152B00 + for ; + Fri, 8 Jul 2005 21:09:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12985-01 + for ; + Sat, 9 Jul 2005 00:09:48 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 9477952B09 + for ; + Fri, 8 Jul 2005 21:09:48 -0300 (ADT) +Received: from [192.168.1.100] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j6909loQ001117; Fri, 8 Jul 2005 17:09:51 -0700 +Message-ID: <42CF15CC.9040203@commandprompt.com> +Date: Fri, 08 Jul 2005 17:09:48 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Bailey, Larry" +Cc: pgsql-performance@postgresql.org +Subject: Re: How to revoke a password +References: + +In-Reply-To: + +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/96 +X-Sequence-Number: 13337 + +Bailey, Larry wrote: +> I created a user with a password. That newly created user now have +> tables and indexes. I want to ALTER that user to exclude the password. +> How is this accomplished without dropping and recreating the users? + +Never tried to go backwards before but: + +alter user foo with encrypted password ''; + +But as I look at pg_shadow there is still a hash... + +You could do: + +update pg_shadow set passwd = '' where usename = 'foo'; + +Sincerely, + +Joshua D. Drake + + +> +> Larry Bailey +> Sr. Oracle DBA +> First American Real Estate Solution +> (714) 701-3347 +> lbailey@firstam.com +> ********************************************************************** +> This message contains confidential information intended only for the +> use of the addressee(s) named above and may contain information that +> is legally privileged. If you are not the addressee, or the person +> responsible for delivering it to the addressee, you are hereby +> notified that reading, disseminating, distributing or copying this +> message is strictly prohibited. If you have received this message by +> mistake, please immediately notify us by replying to the message and +> delete the original message immediately thereafter. +> +> Thank you. FADLD Tag +> ********************************************************************** +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend + + +-- +Your PostgreSQL solutions provider, Command Prompt, Inc. +24x7 support - 1.800.492.2240, programming, and consulting +Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit +http://www.commandprompt.com / http://www.postgresql.org + +From pgsql-performance-owner@postgresql.org Fri Jul 8 21:16:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1959352A03 + for ; + Fri, 8 Jul 2005 21:16:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07822-09 + for ; + Sat, 9 Jul 2005 00:16:37 +0000 (GMT) +Received: from wsmailap02.firstam.com (outbound-smtp02.firstam.com + [208.246.101.198]) + by svr1.postgresql.org (Postfix) with ESMTP id B45AF52B00 + for ; + Fri, 8 Jul 2005 21:16:33 -0300 (ADT) +Received: from 172.21.131.6 by wsmailap01.firstam.com with ESMTP ( + Tumbleweed MMS SMTP Relay (MMS v5.6.3)); Fri, 08 Jul 2005 17:16:25 + -0700 +X-Server-Uuid: 2A3A6F04-3324-429D-9DE4-35238E3EA19C +Received: from anammx01.ana.firstamdata.com ([192.168.173.35]) by + famarp02.firstam.com (MOS 3.5.6-GR) with SMTP id JCL60623; Fri, 8 Jul + 2005 17:16:28 -0700 (PDT) +Received: from pisgana01sxch21.ana.firstamdata.com (Not + Verified[192.168.173.71]) by mailgateway.firstam.com (post.office MTA + v5.0 0924 ) with ESMTP id ; Fri, 08 Jul 2005 17:16:28 -0700 +Received: from pisgana01sxch01.ana.firstamdata.com ([192.168.173.70]) by + pisgana01sxch21.ana.firstamdata.com with Microsoft SMTPSVC(6.0.3790.211 + ); Fri, 8 Jul 2005 17:16:27 -0700 +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: Re: How to revoke a password +Date: Fri, 8 Jul 2005 17:16:27 -0700 +Message-ID: + +Thread-Topic: [PERFORM] How to revoke a password +Thread-Index: AcWEGo2XOEuF2erwQ0KELy1SMwep4QAAM+Mg +From: "Bailey, Larry" +To: "Joshua D. Drake" +Cc: pgsql-performance@postgresql.org +X-OriginalArrivalTime: 09 Jul 2005 00:16:27.0589 (UTC) + FILETIME=[72DB5F50:01C5841B] +X-WSS-ID: 6ED1C8D31GS118751-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/97 +X-Sequence-Number: 13338 + +Thanks but it is still prompting for a password.=20 + + +Larry Bailey +Sr. Oracle DBA +First American Real Estate Solution +(714) 701-3347 +lbailey@firstam.com=20 +-----Original Message----- +From: Joshua D. Drake [mailto:jd@commandprompt.com]=20 +Sent: Friday, July 08, 2005 5:10 PM +To: Bailey, Larry +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] How to revoke a password + +Bailey, Larry wrote: +> I created a user with a password. That newly created user now have=20 +> tables and indexes. I want to ALTER that user to exclude the password. +> How is this accomplished without dropping and recreating the users? + +Never tried to go backwards before but: + +alter user foo with encrypted password ''; + +But as I look at pg_shadow there is still a hash... + +You could do: + +update pg_shadow set passwd =3D '' where usename =3D 'foo'; + +Sincerely, + +Joshua D. Drake + + +>=20 +> Larry Bailey +> Sr. Oracle DBA +> First American Real Estate Solution +> (714) 701-3347 +> lbailey@firstam.com +> ********************************************************************** +> This message contains confidential information intended only for the=20 +> use of the addressee(s) named above and may contain information that=20 +> is legally privileged. If you are not the addressee, or the person=20 +> responsible for delivering it to the addressee, you are hereby=20 +> notified that reading, disseminating, distributing or copying this=20 +> message is strictly prohibited. If you have received this message by=20 +> mistake, please immediately notify us by replying to the message and=20 +> delete the original message immediately thereafter. +>=20 +> Thank you. FADLD Tag +> ********************************************************************** +>=20 +>=20 +> ---------------------------(end of=20 +> broadcast)--------------------------- +> TIP 6: explain analyze is your friend + + +-- +Your PostgreSQL solutions provider, Command Prompt, Inc. +24x7 support - 1.800.492.2240, programming, and consulting Home of +PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit +http://www.commandprompt.com / http://www.postgresql.org + + + +From pgsql-performance-owner@postgresql.org Fri Jul 8 21:17:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F18CE52A03 + for ; + Fri, 8 Jul 2005 21:17:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12844-10 + for ; + Sat, 9 Jul 2005 00:17:45 +0000 (GMT) +Received: from mr2.surnet.cl (smtp2.surnet.cl [216.155.73.163]) + by svr1.postgresql.org (Postfix) with ESMTP id 242DE5282F + for ; + Fri, 8 Jul 2005 21:17:44 -0300 (ADT) +Received: from smtp2.surnet.cl (216.155.73.169) by mr2.surnet.cl (7.0.031.3) + id 4259ADFA0141AF22; Fri, 8 Jul 2005 20:17:26 -0400 +Received: from smtp2.surnet.cl (mr2.surnet.cl []) + by mr2.surnet.cl ([216.155.73.169]); Sat, 09 Jul 2005 00:17:26 +0000 +Received: from cluster.surnet.cl (216.155.73.164) by smtp2.surnet.cl + (7.0.031.3) id 4259ADE300C499B4; Fri, 8 Jul 2005 20:17:26 -0400 +Received: from alvh.no-ip.org (216.155.85.95) by cluster.surnet.cl (7.0.043) + (authenticated as alvherre@surnet.cl) + id 42B3EF60002F08C0; Fri, 8 Jul 2005 20:17:38 -0400 +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id 82085C2DC70; Fri, 8 Jul 2005 20:17:43 -0400 (CLT) +Date: Fri, 8 Jul 2005 20:17:43 -0400 +From: Alvaro Herrera +To: "Joshua D. Drake" +Cc: "Bailey, Larry" , + pgsql-performance@postgresql.org +Subject: Re: How to revoke a password +Message-ID: <20050709001743.GA10063@alvh.no-ip.org> +References: + + <42CF15CC.9040203@commandprompt.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <42CF15CC.9040203@commandprompt.com> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.742 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/98 +X-Sequence-Number: 13339 + +On Fri, Jul 08, 2005 at 05:09:48PM -0700, Joshua D. Drake wrote: +> Bailey, Larry wrote: +> >I created a user with a password. That newly created user now have +> >tables and indexes. I want to ALTER that user to exclude the password. +> >How is this accomplished without dropping and recreating the users? +> +> Never tried to go backwards before but: +> +> alter user foo with encrypted password ''; + +I think you use NULL as password to ALTER USER. + +-- +Alvaro Herrera () +"Y eso te lo doy firmado con mis l�grimas" (Fiebre del Loco) + +From pgsql-performance-owner@postgresql.org Fri Jul 8 21:56:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D119252A78 + for ; + Fri, 8 Jul 2005 21:56:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17225-08 + for ; + Sat, 9 Jul 2005 00:56:05 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id B4DC2529C8 + for ; + Fri, 8 Jul 2005 21:56:04 -0300 (ADT) +Received: from [192.168.1.100] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j690u4oQ004071; Fri, 8 Jul 2005 17:56:07 -0700 +Message-ID: <42CF20A6.8010901@commandprompt.com> +Date: Fri, 08 Jul 2005 17:56:06 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Bailey, Larry" +Cc: pgsql-performance@postgresql.org +Subject: Re: How to revoke a password +References: + +In-Reply-To: + +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/99 +X-Sequence-Number: 13340 + +Bailey, Larry wrote: +> Thanks but it is still prompting for a password. +> + +Does your pg_hba.conf require a password? + +Sincerely, + +Joshua D. Drake + + +> +> Larry Bailey +> Sr. Oracle DBA +> First American Real Estate Solution +> (714) 701-3347 +> lbailey@firstam.com +> -----Original Message----- +> From: Joshua D. Drake [mailto:jd@commandprompt.com] +> Sent: Friday, July 08, 2005 5:10 PM +> To: Bailey, Larry +> Cc: pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] How to revoke a password +> +> Bailey, Larry wrote: +> +>>I created a user with a password. That newly created user now have +>>tables and indexes. I want to ALTER that user to exclude the password. +>>How is this accomplished without dropping and recreating the users? +> +> +> Never tried to go backwards before but: +> +> alter user foo with encrypted password ''; +> +> But as I look at pg_shadow there is still a hash... +> +> You could do: +> +> update pg_shadow set passwd = '' where usename = 'foo'; +> +> Sincerely, +> +> Joshua D. Drake +> +> +> +>>Larry Bailey +>>Sr. Oracle DBA +>>First American Real Estate Solution +>>(714) 701-3347 +>>lbailey@firstam.com +>>********************************************************************** +>>This message contains confidential information intended only for the +>>use of the addressee(s) named above and may contain information that +>>is legally privileged. If you are not the addressee, or the person +>>responsible for delivering it to the addressee, you are hereby +>>notified that reading, disseminating, distributing or copying this +>>message is strictly prohibited. If you have received this message by +>>mistake, please immediately notify us by replying to the message and +>>delete the original message immediately thereafter. +>> +>>Thank you. FADLD Tag +>>********************************************************************** +>> +>> +>>---------------------------(end of +>>broadcast)--------------------------- +>>TIP 6: explain analyze is your friend +> +> +> +> -- +> Your PostgreSQL solutions provider, Command Prompt, Inc. +> 24x7 support - 1.800.492.2240, programming, and consulting Home of +> PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit +> http://www.commandprompt.com / http://www.postgresql.org +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: don't forget to increase your free space map settings + + +-- +Your PostgreSQL solutions provider, Command Prompt, Inc. +24x7 support - 1.800.492.2240, programming, and consulting +Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit +http://www.commandprompt.com / http://www.postgresql.org + +From pgsql-performance-owner@postgresql.org Fri Jul 8 21:58:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D9AD52AEF + for ; + Fri, 8 Jul 2005 21:58:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28175-04 + for ; + Sat, 9 Jul 2005 00:58:20 +0000 (GMT) +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by svr1.postgresql.org (Postfix) with ESMTP id ED37852AEC + for ; + Fri, 8 Jul 2005 21:58:19 -0300 (ADT) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j690wGg2099724 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Fri, 8 Jul 2005 18:58:18 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j690wGfw011609; + Fri, 8 Jul 2005 18:58:16 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j690wFu8011608; + Fri, 8 Jul 2005 18:58:15 -0600 (MDT) (envelope-from mfuhr) +Date: Fri, 8 Jul 2005 18:58:15 -0600 +From: Michael Fuhr +To: "Bailey, Larry" +Cc: "Joshua D. Drake" , pgsql-performance@postgresql.org +Subject: Re: How to revoke a password +Message-ID: <20050709005815.GA11532@winnie.fuhr.org> +References: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/100 +X-Sequence-Number: 13341 + +On Fri, Jul 08, 2005 at 05:16:27PM -0700, Bailey, Larry wrote: +> +> Thanks but it is still prompting for a password. + +Let's back up a bit: what problem are you trying to solve? Do you +want the user to be able to log in without entering a password? If +so then see "Client Authentication" in the documentation: + +http://www.postgresql.org/docs/8.0/static/client-authentication.html + +If you're trying to do something else then please elaborate, as +it's not clear what you mean by "I want to ALTER that user to exclude +the password." + +-- +Michael Fuhr +http://www.fuhr.org/~mfuhr/ + +From pgsql-performance-owner@postgresql.org Mon Jul 11 20:28:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 323135282C + for ; + Sat, 9 Jul 2005 15:38:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61806-02 + for ; + Sat, 9 Jul 2005 18:38:47 +0000 (GMT) +Received: from nextmail.ru (unknown [83.222.5.149]) + by svr1.postgresql.org (Postfix) with SMTP id 2EABF52820 + for ; + Sat, 9 Jul 2005 15:38:42 -0300 (ADT) +Received: (qmail 57103 invoked from network); 9 Jul 2005 18:38:51 -0000 +Received: from ppp85-140-125-53.pppoe.mtu-net.ru (HELO z) (85.140.125.53) + by nextmail.ru with SMTP; 9 Jul 2005 18:38:51 -0000 +From: "jobapply" +To: +Subject: Sorting on longer key is faster ? +Date: Sat, 9 Jul 2005 22:38:40 +0400 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Mailer: Microsoft Office Outlook, Build 11.0.6353 +Thread-Index: AcWEtWWnpTyLkFRvR2eGsKrTi7ZHLA== +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +Message-Id: <20050709183842.2EABF52820@svr1.postgresql.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=2.078 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, MSGID_FROM_MTA_ID +X-Spam-Level: ** +X-Archive-Number: 200507/112 +X-Sequence-Number: 13353 + +The 2 queries are almost same, but ORDER BY x||t is FASTER than ORDER BY x.. + +How can that be possible? + +Btw: x and x||t are same ordered + +phoeniks=> explain analyze SELECT * FROM test WHERE i<20 ORDER BY x || t; + QUERY PLAN + +---------------------------------------------------------------------------- +---------------------------------------------- + Sort (cost=2282.65..2284.92 rows=907 width=946) (actual +time=74.982..79.114 rows=950 loops=1) + Sort Key: (x || t) + -> Index Scan using i_i on test (cost=0.00..2238.09 rows=907 width=946) +(actual time=0.077..51.015 rows=950 loops=1) + Index Cond: (i < 20) + Total runtime: 85.944 ms +(5 rows) + +phoeniks=> explain analyze SELECT * FROM test WHERE i<20 ORDER BY x; + QUERY PLAN +---------------------------------------------------------------------------- +--------------------------------------------- + Sort (cost=2280.38..2282.65 rows=907 width=946) (actual +time=175.431..179.239 rows=950 loops=1) + Sort Key: x + -> Index Scan using i_i on test (cost=0.00..2235.82 rows=907 width=946) +(actual time=0.024..5.378 rows=950 loops=1) + Index Cond: (i < 20) + Total runtime: 183.317 ms +(5 rows) + + + + + +phoeniks=> \d+ test + Table "public.test" + Column | Type | Modifiers | Description +--------+---------+-----------+------------- + i | integer | | + t | text | | + x | text | | +Indexes: + "i_i" btree (i) + "x_i" btree (xpath_string(x, 'data'::text)) + "x_ii" btree (xpath_string(x, 'movie/characters/character'::text)) +Has OIDs: no + + +From pgsql-performance-owner@postgresql.org Sat Jul 9 18:48:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9616152B12 + for ; + Sat, 9 Jul 2005 18:48:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92895-08 + for ; + Sat, 9 Jul 2005 21:48:43 +0000 (GMT) +Received: from smtp-out5.blueyonder.co.uk (smtp-out5.blueyonder.co.uk + [195.188.213.8]) + by svr1.postgresql.org (Postfix) with ESMTP id E979F52B20 + for ; + Sat, 9 Jul 2005 18:48:41 -0300 (ADT) +Received: from [192.168.1.10] ([82.43.93.192]) by smtp-out5.blueyonder.co.uk + with Microsoft SMTPSVC(5.0.2195.6713); + Sat, 9 Jul 2005 22:49:26 +0100 +In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3415C2CFE@Herge.rcsinc.local> +References: <6EE64EF3AB31D5448D0007DD34EEB3415C2CFE@Herge.rcsinc.local> +Mime-Version: 1.0 (Apple Message framework v730) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <41DED96F-84A2-436A-86C7-B3C2A3210591@advfn.com> +Cc: , "Stuart Bishop" , + +Content-Transfer-Encoding: 7bit +From: Alex Stapleton +Subject: Re: Mount database on RAM disk? +Date: Sat, 9 Jul 2005 22:48:43 +0100 +To: Merlin Moncure +X-Mailer: Apple Mail (2.730) +X-OriginalArrivalTime: 09 Jul 2005 21:49:26.0686 (UTC) + FILETIME=[139A23E0:01C584D0] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/101 +X-Sequence-Number: 13342 + + +On 8 Jul 2005, at 20:21, Merlin Moncure wrote: + +>> Stuart, +>> +>> +>>> I'm putting together a road map on how our systems can scale as our +>>> +> load +> +>>> increases. As part of this, I need to look into setting up some fast +>>> read only mirrors of our database. We should have more than enough +>>> +> RAM +> +>>> to fit everything into memory. I would like to find out if I could +>>> expect better performance by mounting the database from a RAM disk, +>>> +> or +> +>>> if I would be better off keeping that RAM free and increasing the +>>> effective_cache_size appropriately. +>>> +>> +>> If you're accessing a dedicated, read-only system with a database +>> +> small +> +>> enough to fit in RAM, it'll all be cached there anyway, at least on +>> +> Linux +> +>> and BSD. You won't be gaining anything by creating a ramdisk. +>> +> +> +> +> ditto windows. +> +> Files cached in memory are slower than reading straight from memory +> but +> not nearly enough to justify reserving memory for your use. In other +> words, your O/S is a machine with years and years of engineering +> designed best how to dole memory out to caching and various processes. +> Why second guess it? + +Because sometimes it gets it wrong. The most brutal method is +occasionally the most desirable. Even if it not the "right" way to do +it. + +> Merlin +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 5: don't forget to increase your free space map settings +> + + +From pgsql-performance-owner@postgresql.org Sun Jul 10 01:50:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DE2655293B + for ; + Sun, 10 Jul 2005 01:50:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10229-01 + for ; + Sun, 10 Jul 2005 04:50:09 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 2A5515281A + for ; + Sun, 10 Jul 2005 01:50:06 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 1EBD430B42; Sun, 10 Jul 2005 06:54:25 +0200 (MET DST) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: Mount database on RAM disk? +Date: Sun, 10 Jul 2005 00:54:37 -0400 +Organization: cbbrowne Computing Inc +Lines: 31 +Message-ID: +References: <6EE64EF3AB31D5448D0007DD34EEB3415C2CFE@Herge.rcsinc.local> + <41DED96F-84A2-436A-86C7-B3C2A3210591@advfn.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.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, + berkeley-unix) +Cancel-Lock: sha1:ZaBaYpuXjz9ZoRWJrULZb8VPKhI= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/102 +X-Sequence-Number: 13343 + +> On 8 Jul 2005, at 20:21, Merlin Moncure wrote: +>> ditto windows. +>> +>> Files cached in memory are slower than reading straight from memory +>> but not nearly enough to justify reserving memory for your use. In +>> other words, your O/S is a machine with years and years of +>> engineering designed best how to dole memory out to caching and +>> various processes. Why second guess it? +> +> Because sometimes it gets it wrong. The most brutal method is +> occasionally the most desirable. Even if it not the "right" way to do +> it. + +The fact that cache allows reads to come from memory means that for +read-oriented activity, you're generally going to be better off +leaving RAM as "plain ordinary system memory" so that it can +automatically be drawn into service as cache. + +Thus, the main reason to consider using a RAM-disk is the fact that +update times are negligible as there is not the latency of a +round-trip to the disk. + +That would encourage its use for write-heavy tables, with the STRONG +caveat that a power outage could readily destroy the database :-(. +-- +let name="cbbrowne" and tld="acm.org" in String.concat "@" [name;tld];; +http://cbbrowne.com/info/rdbms.html +Rules of the Evil Overlord #153. "My Legions of Terror will be an +equal-opportunity employer. Conversely, when it is prophesied that no +man can defeat me, I will keep in mind the increasing number of +non-traditional gender roles." + +From pgsql-performance-owner@postgresql.org Mon Jul 11 20:29:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 33BEB52B80 + for ; + Sun, 10 Jul 2005 19:07:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10162-01 + for ; + Sun, 10 Jul 2005 22:07:20 +0000 (GMT) +Received: from r163ip.btv.lv (r163ip.btv.lv [217.198.224.163]) + by svr1.postgresql.org (Postfix) with ESMTP id BF84352ABB + for ; + Sun, 10 Jul 2005 19:07:18 -0300 (ADT) +Received: from p4 (pIV.homenet [192.168.88.4]) + by r163ip.btv.lv (8.12.9/8.12.6) with ESMTP id j6AM7Ep6073933 + for ; + Mon, 11 Jul 2005 01:07:18 +0300 (EEST) + (envelope-from postgres@bilteks.com) +From: "Alexander Kirpa" +To: pgsql-performance@postgresql.org +Date: Mon, 11 Jul 2005 01:07:14 +0300 +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +Content-transfer-encoding: 7BIT +Subject: Re: Data Warehousing Tuning +Message-ID: <42D1C642.16182.39B63C29@localhost> +X-mailer: Pegasus Mail for Win32 (v3.12c) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/113 +X-Sequence-Number: 13354 + +>- Sun V250 server +>- 2*1.3GHz Sparc IIIi CPU +>- 8GB RAM +>- 8*73GB SCSI drives +>- Solaris 10 +>- Postgres 8 +>4) We moved the pg_xlog files off /data/postgres (disks 2-7) and into +>/opt/pg_xlog (disks 0-1), but it seemed like performance decreased, +>so we moved them back again. +You have saturated SCSI bus. +1x160GB/s SCSI too small for 8xHDD with 30-70MB/s +Solutions: +Replace CD/DVD/tape at top 2x5" slots on 2xHDD (320 SCSI), + install PCI 64/66 SCSI 320 controller + (or simple RAID1 controller for minimize + saturation of PCI buses) + and attach to 2xHDD. Move /opt/pg_xlog on this drives. + +Best regards, + Alexander Kirpa + + + +From pgsql-performance-owner@postgresql.org Mon Jul 11 08:31:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D0645283C + for ; + Mon, 11 Jul 2005 08:31:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 15805-03 + for ; + Mon, 11 Jul 2005 11:31:49 +0000 (GMT) +Received: from cmailg1.svr.pol.co.uk (cmailg1.svr.pol.co.uk [195.92.195.171]) + by svr1.postgresql.org (Postfix) with ESMTP id BC5975287F + for ; + Mon, 11 Jul 2005 08:31:43 -0300 (ADT) +Received: from modem-2435.leopard.dialup.pol.co.uk ([217.135.153.131] + helo=192.168.0.102) by cmailg1.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DrwVi-0005oz-LJ; Mon, 11 Jul 2005 12:31:43 +0100 +Subject: Re: cost-based vacuum +From: Simon Riggs +To: Ian Westmacott +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1120839902.20657.197.camel@spectre.intellivid.com> +References: <1120839902.20657.197.camel@spectre.intellivid.com> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Mon, 11 Jul 2005 12:31:44 +0100 +Message-Id: <1121081504.3970.53.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/103 +X-Sequence-Number: 13344 + +On Fri, 2005-07-08 at 12:25 -0400, Ian Westmacott wrote: +> I am beginning to look at Postgres 8, and am particularly +> interested in cost-based vacuum/analyze. I'm hoping someone +> can shed some light on the behavior I am seeing. +> +> Suppose there are three threads: +> +> writer_thread +> every 1/15 second do +> BEGIN TRANSACTION +> COPY table1 FROM stdin +> ... +> COPY tableN FROM stdin +> perform several UPDATEs, DELETEs and INSERTs +> COMMIT +> +> reader_thread +> every 1/15 second do +> BEGIN TRANSACTION +> SELECT FROM table1 ... +> ... +> SELECT FROM tableN ... +> COMMIT +> +> analyze_thread +> every 5 minutes do +> ANALYZE table1 +> ... +> ANALYZE tableN +> +> +> Now, Postgres 8.0.3 out-of-the-box (all default configs) on a +> particular piece of hardware runs the Postgres connection for +> writer_thread at about 15% CPU (meaningless, I know, but for +> comparison) and runs the Postgres connection for reader_thread +> at about 30% CPU. Latency for reader_thread seeing updates +> from writer_thread is well under 1/15s. Impact of +> analyze_thread is negligible. +> +> If I make the single configuration change of setting +> vacuum_cost_delay=1000, each iteration in analyze_thread takes +> much longer, of course. But what I also see is that the CPU +> usage of the connections for writer_thread and reader_thread +> spike up to well over 80% each (this is a dualie) and latency +> drops to 8-10s, during the ANALYZEs. +> +> I don't understand why this would be. I don't think there +> are any lock issues, and I don't see any obvious I/O issues. +> Am I missing something? Is there any way to get some +> insight into what those connections are doing? + +The ANALYZE commands hold read locks on the tables you wish to write to. +If you slow them down, you merely slow down your write transactions +also, and then the read transactions that wait behind them. Every time +the ANALYZE sleeps it wakes up the other transactions, which then +realise they can't move because of locks and then wake up the ANALYZEs +for another shot. The end result is that you introduce more context- +switching, without any chance of doing more useful work while the +ANALYZEs sleep. + +Don't use the vacuum_cost_delay in this situation. You might try setting +it to 0 for the analyze_thread only. + +Sounds like you could speed things up by splitting everything into two +sets of tables, with writer_thread1 and writer_thread2 etc. That way +your 2 CPUs would be able to independently be able to get through more +work without locking each other out. + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Mon Jul 11 09:59:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2175252933 + for ; + Mon, 11 Jul 2005 09:59:55 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42328-07 + for ; + Mon, 11 Jul 2005 12:59:50 +0000 (GMT) +Received: from web54702.mail.yahoo.com (web54702.mail.yahoo.com + [68.142.225.200]) + by svr1.postgresql.org (Postfix) with SMTP id A588252849 + for ; + Mon, 11 Jul 2005 09:59:48 -0300 (ADT) +Received: (qmail 50725 invoked by uid 60001); 11 Jul 2005 12:59:51 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=uRsb9G+llvpPE1zh2c9FlYOExmxnS5yZrUCKxyS2/2HamwfodWLWxOQCfiU59baM32Y3Jw1AlrQn5dhBK7ZMZ8QVv0vN9aET3YI3HoNZ9MkS8PUfH8IKzbCw6dhpCpZbWvruBHd4PuOVOcND4l0k+qyWfBlFaPFfSmv/RGNWNPU= + ; +Message-ID: <20050711125951.50723.qmail@web54702.mail.yahoo.com> +Received: from [200.91.204.38] by web54702.mail.yahoo.com via HTTP; + Mon, 11 Jul 2005 07:59:51 CDT +Date: Mon, 11 Jul 2005 07:59:51 -0500 (CDT) +From: Alejandro Lemus +Subject: Question +To: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.752 tagged_above=0 required=5 tests=AWL, + FROM_ENDS_IN_NUMS, FROM_HAS_ULINE_NUMS +X-Spam-Level: * +X-Archive-Number: 200507/104 +X-Sequence-Number: 13345 + +In the past week, one guy of Unix Group in Colombia +say: "Postgrest in production is bat, if the power off +in any time the datas is lost why this datas is in +plain files. Postgrest no ssupport data bases with +more 1 millon of records". +Wath tell me in this respect?, is more best Informix +as say + +Ing. Alejandro Lemus G. +Radio Taxi Aeropuerto S.A. +Avenida de las Am�ricas # 51 - 39 Bogot� - Colombia +Tel: 571-4470694 / 571-4202600 Ext. 260 Fax: 571-2624070 +email: alejandro_lemus2003@yahoo.com + +__________________________________________________ +Correo Yahoo! +Espacio para todos tus mensajes, antivirus y antispam �gratis! +Reg�strate ya - http://correo.espanol.yahoo.com/ + +From pgsql-performance-owner@postgresql.org Mon Jul 11 10:07:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4EFDA5281F + for ; + Mon, 11 Jul 2005 10:07:48 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 43269-07 + for ; + Mon, 11 Jul 2005 13:07:43 +0000 (GMT) +Received: from mailhost.intellivid.com (mailhost.intellivid.com + [64.32.200.11]) + by svr1.postgresql.org (Postfix) with ESMTP id AB5A852802 + for ; + Mon, 11 Jul 2005 10:07:43 -0300 (ADT) +Received: from [192.168.2.68] (spectre.intellivid.com [192.168.2.68]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (Client did not present a certificate) + by newmail.intellivid.com (Postfix) with ESMTP id 8379EF1829C; + Mon, 11 Jul 2005 09:07:46 -0400 (EDT) +Subject: Re: cost-based vacuum +From: Ian Westmacott +To: Simon Riggs +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1121081504.3970.53.camel@localhost.localdomain> +References: <1120839902.20657.197.camel@spectre.intellivid.com> + <1121081504.3970.53.camel@localhost.localdomain> +Content-Type: text/plain +Organization: Intellivid Corp. +Message-Id: <1121087266.27427.35.camel@spectre.intellivid.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 +Date: Mon, 11 Jul 2005 09:07:46 -0400 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/105 +X-Sequence-Number: 13346 + +On Mon, 2005-07-11 at 07:31, Simon Riggs wrote: +> The ANALYZE commands hold read locks on the tables you wish to write to. +> If you slow them down, you merely slow down your write transactions +> also, and then the read transactions that wait behind them. Every time +> the ANALYZE sleeps it wakes up the other transactions, which then +> realise they can't move because of locks and then wake up the ANALYZEs +> for another shot. The end result is that you introduce more context- +> switching, without any chance of doing more useful work while the +> ANALYZEs sleep. + +Let me make sure I understand. ANALYZE acquires a read +lock on the table, that it holds until the operation is +complete (including any sleeps). That read lock blocks +the extension of that table via COPY. Is that right? + +According to the 8.0 docs, ANALYZE acquires an ACCESS SHARE +lock on the table, and that conflicts only with ACCESS +EXCLUSIVE. Thats why I didn't think I had a lock issue, +since I think COPY only needs ROW EXCLUSIVE. Or perhaps +the transaction needs something more? + +Thanks, + + --Ian + + + +From pgsql-performance-owner@postgresql.org Mon Jul 11 10:29:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 564815281F + for ; + Mon, 11 Jul 2005 10:29:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46965-05 + for ; + Mon, 11 Jul 2005 13:28:54 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1EBF352809 + for ; + Mon, 11 Jul 2005 10:28:53 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6BDSqq1007753; + Mon, 11 Jul 2005 09:28:52 -0400 (EDT) +To: Simon Riggs +Cc: Ian Westmacott , + pgsql-performance@postgresql.org +Subject: Re: cost-based vacuum +In-reply-to: <1121081504.3970.53.camel@localhost.localdomain> +References: <1120839902.20657.197.camel@spectre.intellivid.com> + <1121081504.3970.53.camel@localhost.localdomain> +Comments: In-reply-to Simon Riggs + message dated "Mon, 11 Jul 2005 12:31:44 +0100" +Date: Mon, 11 Jul 2005 09:28:52 -0400 +Message-ID: <7752.1121088532@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/106 +X-Sequence-Number: 13347 + +Simon Riggs writes: +>> I don't understand why this would be. I don't think there +>> are any lock issues, and I don't see any obvious I/O issues. + +> The ANALYZE commands hold read locks on the tables you wish to write to. + +Unless there were more commands that Ian didn't show us, he's not taking +any locks that would conflict with ANALYZE. So I don't believe this is +the explanation. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 11 10:30:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5AB0852809 + for ; + Mon, 11 Jul 2005 10:30:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46440-08 + for ; + Mon, 11 Jul 2005 13:30:18 +0000 (GMT) +Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) + by svr1.postgresql.org (Postfix) with ESMTP id 543095297B + for ; + Mon, 11 Jul 2005 10:30:16 -0300 (ADT) +Received: from mainbox.archonet.com + (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) + by smtp.metronet.co.uk (MetroNet Mail) with ESMTP + id 38795414F46; Mon, 11 Jul 2005 14:30:10 +0100 (BST) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP id 45F7515ED6; + Mon, 11 Jul 2005 14:29:10 +0100 (BST) +Received: from mainbox.archonet.com ([127.0.0.1]) + by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 19615-06; Mon, 11 Jul 2005 14:29:07 +0100 (BST) +Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP id 6F6CA15ED5; + Mon, 11 Jul 2005 14:29:07 +0100 (BST) +Message-ID: <42D27423.1010808@archonet.com> +Date: Mon, 11 Jul 2005 14:29:07 +0100 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Alejandro Lemus +Cc: pgsql-performance@postgresql.org +Subject: Re: Question +References: <20050711125951.50723.qmail@web54702.mail.yahoo.com> +In-Reply-To: <20050711125951.50723.qmail@web54702.mail.yahoo.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/107 +X-Sequence-Number: 13348 + +Perhaps choose a better subject than "question" next time? + +Alejandro Lemus wrote: +> In the past week, one guy of Unix Group in Colombia +> say: "Postgrest in production is bat, if the power off +> in any time the datas is lost + +Wrong. And it's called "PostgreSQL". + + > why this datas is in +> plain files. Postgrest no ssupport data bases with +> more 1 millon of records". + +Wrong. + +> Wath tell me in this respect?, is more best Informix +> as say + +Your contact in the Unix Group in Columbia obviously talks on subjects +where he knows little. Perhaps re-evaluate anything else you've heard +from him. + +You can find details on PostgreSQL at http://www.postgresql.org/, +including the manuals: + http://www.postgresql.org/docs/8.0/static/index.html +The FAQ: + http://www.postgresql.org/docs/faq/ +Spanish/Brazilian communities, which might prove useful + http://www.postgresql.org/community/international + +PostgreSQL is licensed under the BSD licence, which means you can freely +download or deploy it in a commercial setting if you desire. + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Mon Jul 11 10:35:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CE7485296E + for ; + Mon, 11 Jul 2005 10:35:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50519-04 + for ; + Mon, 11 Jul 2005 13:34:57 +0000 (GMT) +Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) + by svr1.postgresql.org (Postfix) with ESMTP id DBE0452977 + for ; + Mon, 11 Jul 2005 10:34:52 -0300 (ADT) +Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) + by mx-2.sollentuna.net (Postfix) with ESMTP + id 05F178F284; Mon, 11 Jul 2005 15:34:52 +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.7226.0 +Subject: Re: Question +Date: Mon, 11 Jul 2005 15:34:51 +0200 +Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE6C7756@algol.sollentuna.se> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Question +Thread-Index: AcWGGPuxqXR4tdx6Sb+/b1jXaLAc8gAA/LLA +From: "Magnus Hagander" +To: "Alejandro Lemus" , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/108 +X-Sequence-Number: 13349 + +> In the past week, one guy of Unix Group in Colombia +> say: "Postgrest in production is bat, if the power off in any=20 +> time the datas is lost why this datas is in plain files.=20 +> Postgrest no ssupport data bases with more 1 millon of records".=20 +> Wath tell me in this respect?, is more best Informix as say=20 + +Both these statements are completely incorrect.=20 + +Unlike some other "database systems", PostgreSQL *does* survive power +loss without any major problems. Assuming you use a metadata journailng +filesystem, and don't run with non-battery-backed write-cache (but no db +can survive that..) + +And having a million records is no problem at all. You may run into +considerations when you're talking billions, but you can do that as well +- it just takes a bit more knowledge before you can do it right. + +//Magnus + +From pgsql-performance-owner@postgresql.org Mon Jul 11 11:51:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 473765284D + for ; + Mon, 11 Jul 2005 11:51:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66453-10 + for ; + Mon, 11 Jul 2005 14:51:24 +0000 (GMT) +Received: from cmailg4.svr.pol.co.uk (cmailg4.svr.pol.co.uk [195.92.195.174]) + by svr1.postgresql.org (Postfix) with ESMTP id F1C2852824 + for ; + Mon, 11 Jul 2005 11:51:23 -0300 (ADT) +Received: from modem-1688.lion.dialup.pol.co.uk ([217.135.166.152] + helo=192.168.0.102) by cmailg4.svr.pol.co.uk with esmtp (Exim 4.41) + id 1Drzd0-0002CH-S4; Mon, 11 Jul 2005 15:51:27 +0100 +Subject: Re: cost-based vacuum +From: Simon Riggs +To: Ian Westmacott +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1121087266.27427.35.camel@spectre.intellivid.com> +References: <1120839902.20657.197.camel@spectre.intellivid.com> + <1121081504.3970.53.camel@localhost.localdomain> + <1121087266.27427.35.camel@spectre.intellivid.com> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Mon, 11 Jul 2005 15:51:28 +0100 +Message-Id: <1121093488.3970.70.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/109 +X-Sequence-Number: 13350 + +On Mon, 2005-07-11 at 09:07 -0400, Ian Westmacott wrote: +> On Mon, 2005-07-11 at 07:31, Simon Riggs wrote: +> > The ANALYZE commands hold read locks on the tables you wish to write to. +> > If you slow them down, you merely slow down your write transactions +> > also, and then the read transactions that wait behind them. Every time +> > the ANALYZE sleeps it wakes up the other transactions, which then +> > realise they can't move because of locks and then wake up the ANALYZEs +> > for another shot. The end result is that you introduce more context- +> > switching, without any chance of doing more useful work while the +> > ANALYZEs sleep. +> +> Let me make sure I understand. ANALYZE acquires a read +> lock on the table, that it holds until the operation is +> complete (including any sleeps). That read lock blocks +> the extension of that table via COPY. Is that right? +> +> According to the 8.0 docs, ANALYZE acquires an ACCESS SHARE +> lock on the table, and that conflicts only with ACCESS +> EXCLUSIVE. Thats why I didn't think I had a lock issue, +> since I think COPY only needs ROW EXCLUSIVE. Or perhaps +> the transaction needs something more? + +The docs are correct, but don't show catalog and buffer locks. + +...but on further reading of the code there are no catalog locks or +buffer locks held across the sleep points. So, my explanation doesn't +work as an explanation for the sleep/no sleep difference you have +observed. + +Best Regards, Simon Riggs + + + + + +From pgsql-performance-owner@postgresql.org Mon Jul 11 20:26:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AD8BA528D5 + for ; + Mon, 11 Jul 2005 20:26:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71872-05 + for ; + Mon, 11 Jul 2005 23:26:25 +0000 (GMT) +Received: from loki.globexplorer.com (loki.globexplorer.com [208.35.14.101]) + by svr1.postgresql.org (Postfix) with ESMTP id 75BBC52824 + for ; + Mon, 11 Jul 2005 20:26:22 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Question +Date: Mon, 11 Jul 2005 16:26:23 -0700 +Message-ID: + <71E37EF6B7DCC1499CEA0316A256832801D4C5BB@loki.wc.globexplorer.net> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Question +Thread-Index: AcWGGO7BHh8jYKuKTOesRaRPQ7f+bwAWkIXQ +From: "Gregory S. Williamson" +To: "Alejandro Lemus" , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/110 +X-Sequence-Number: 13351 + +As a sometimes Informix and PostgreSQL DBA, I disagree with the = +contentions below. We have many tables with 10s of millions of rows in = +Postgres. We have had (alas) power issues with our lab on more than one = +occasion and the afflicted servers have recovered like a champ, every = +time. + +This person may not like postgres (or very much likes Informix), but he = +shouldn't conjure up spurious reasons to support his/her prejudice. + +Informix is an excellent product, but it can be costly for web related = +applications. PostgeSQL is also an excellent database. Each has = +differences which may make the decision between the two of them clear. = +But facts are necessary to have a real discussion. + +Greg WIlliamson +DBA +GlobeXplorer LLC + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Alejandro +Lemus +Sent: Monday, July 11, 2005 6:00 AM +To: pgsql-performance@postgresql.org +Subject: [PERFORM] Question + + +In the past week, one guy of Unix Group in Colombia +say: "Postgrest in production is bat, if the power off +in any time the datas is lost why this datas is in +plain files. Postgrest no ssupport data bases with +more 1 millon of records".=20 +Wath tell me in this respect?, is more best Informix +as say=20 + +Ing. Alejandro Lemus G. +Radio Taxi Aeropuerto S.A. +Avenida de las Am=E9ricas # 51 - 39 Bogot=E1 - Colombia +Tel: 571-4470694 / 571-4202600 Ext. 260 Fax: 571-2624070 +email: alejandro_lemus2003@yahoo.com + +__________________________________________________ +Correo Yahoo! +Espacio para todos tus mensajes, antivirus y antispam =A1gratis!=20 +Reg=EDstrate ya - http://correo.espanol.yahoo.com/=20 + +---------------------------(end of broadcast)--------------------------- +TIP 6: explain analyze is your friend + +!DSPAM:42d26e2065882109568359! + + +From pgsql-performance-owner@postgresql.org Mon Jul 11 20:39:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E4D1A52987 + for ; + Mon, 11 Jul 2005 20:39:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73684-09 + for ; + Mon, 11 Jul 2005 23:39:22 +0000 (GMT) +Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) + by svr1.postgresql.org (Postfix) with ESMTP id E1BA852983 + for ; + Mon, 11 Jul 2005 20:39:17 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP + id <20050711233920m9100ceqiae>; Mon, 11 Jul 2005 23:39:20 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id E37B855FEC; Mon, 11 Jul 2005 18:39:19 -0500 (CDT) +Received: from [192.168.1.102] (209-181-211-15.cdrr.qwest.net + [209.181.211.15]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 8050E55F98; + Mon, 11 Jul 2005 18:39:10 -0500 (CDT) +Message-ID: <42D3031C.8050907@arbash-meinel.com> +Date: Mon, 11 Jul 2005 18:39:08 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dario Pudlo +Cc: pgsql-performance@postgresql.org +Subject: Re: join and query planner +References: +In-Reply-To: +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigAC7C853A4D28D578E3FB0172" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/114 +X-Sequence-Number: 13355 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigAC7C853A4D28D578E3FB0172 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Dario Pudlo wrote: +> (first at all, sorry for my english) +> Hi. +> - Does "left join" restrict the order in which the planner must join +> tables? I've read about join, but i'm not sure about left join... +> - If so: Can I avoid this behavior? I mean, make the planner resolve the +> query, using statistics (uniqueness, data distribution) rather than join +> order. +> +> My query looks like: +> SELECT ... +> FROM a, b, +> LEFT JOIN c ON (c.key = a.key) +> LEFT JOIN d on (d.key=a.key) +> WHERE (a.key = b.key) AND (b.column <= 100) +> +> b.column has a lot better selectivity, but planner insist on resolve +> first c.key = a.key. +> +> Of course, I could rewrite something like: +> SELECT ... +> FROM +> (SELECT ... +> FROM a,b +> LEFT JOIN d on (d.key=a.key) +> WHERE (b.column <= 100) +> ) +> as aa +> LEFT JOIN c ON (c.key = aa.key) +> +> but this is query is constructed by an application with a "multicolumn" +> filter. It's dynamic. +> It means that a user could choose to look for "c.column = 1000". And +> also, combinations of filters. +> +> So, I need the planner to choose the best plan... + +Probably forcing the other join earlier could help: +SELECT ... + FROM a JOIN b ON (a.key = b.key) + LEFT JOIN c ON (c.key = a.key) +... + +I think the problem is that postgresql can't break JOIN syntax very +easily. But you can make the JOIN earlier. + +John +=:-> +> +> I've already change statistics, I clustered tables with cluster, ran vacuum +> analyze, changed work_mem, shared_buffers... +> +> Greetings. TIA. +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster +> + + +--------------enigAC7C853A4D28D578E3FB0172 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC0wMcJdeBCYSNAAMRAs+mAJ4y/5cqJ6BshkSFmos3M/wCXuZf6gCeMiQB +vLDYL89Rt1TCEGFFkOm9lhI= +=QwbF +-----END PGP SIGNATURE----- + +--------------enigAC7C853A4D28D578E3FB0172-- + +From pgsql-performance-owner@postgresql.org Mon Jul 11 20:42:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7C6885287D + for ; + Mon, 11 Jul 2005 20:42:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74943-05 + for ; + Mon, 11 Jul 2005 23:42:13 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id 57D0952998 + for ; + Mon, 11 Jul 2005 20:42:12 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050711234215m920060tite>; Mon, 11 Jul 2005 23:42:15 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id CB24C55FEC; Mon, 11 Jul 2005 18:42:14 -0500 (CDT) +Received: from [192.168.1.102] (209-181-211-15.cdrr.qwest.net + [209.181.211.15]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 3715E55F98; + Mon, 11 Jul 2005 18:42:07 -0500 (CDT) +Message-ID: <42D303CA.2020808@arbash-meinel.com> +Date: Mon, 11 Jul 2005 18:42:02 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: jobapply +Cc: pgsql-performance@postgresql.org +Subject: Re: Sorting on longer key is faster ? +References: <20050709183842.2EABF52820@svr1.postgresql.org> +In-Reply-To: <20050709183842.2EABF52820@svr1.postgresql.org> +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigB810D5620F6C038341525139" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/115 +X-Sequence-Number: 13356 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigB810D5620F6C038341525139 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +jobapply wrote: +> The 2 queries are almost same, but ORDER BY x||t is FASTER than ORDER BY x.. +> +> How can that be possible? +> +> Btw: x and x||t are same ordered +> +> phoeniks=> explain analyze SELECT * FROM test WHERE i<20 ORDER BY x || t; +> QUERY PLAN +> + +What types are x and t, I have the feeling "x || t" is actually a +boolean, so it is only a True/False sort, while ORDER BY x has to do +some sort of string comparison (which might actually be a locale +depended comparison, and strcoll can be very slow on some locales) + +John +=:-> + +> ---------------------------------------------------------------------------- +> ---------------------------------------------- +> Sort (cost=2282.65..2284.92 rows=907 width=946) (actual +> time=74.982..79.114 rows=950 loops=1) +> Sort Key: (x || t) +> -> Index Scan using i_i on test (cost=0.00..2238.09 rows=907 width=946) +> (actual time=0.077..51.015 rows=950 loops=1) +> Index Cond: (i < 20) +> Total runtime: 85.944 ms +> (5 rows) +> +> phoeniks=> explain analyze SELECT * FROM test WHERE i<20 ORDER BY x; +> QUERY PLAN +> ---------------------------------------------------------------------------- +> --------------------------------------------- +> Sort (cost=2280.38..2282.65 rows=907 width=946) (actual +> time=175.431..179.239 rows=950 loops=1) +> Sort Key: x +> -> Index Scan using i_i on test (cost=0.00..2235.82 rows=907 width=946) +> (actual time=0.024..5.378 rows=950 loops=1) +> Index Cond: (i < 20) +> Total runtime: 183.317 ms +> (5 rows) +> +> +> +> +> +> phoeniks=> \d+ test +> Table "public.test" +> Column | Type | Modifiers | Description +> --------+---------+-----------+------------- +> i | integer | | +> t | text | | +> x | text | | +> Indexes: +> "i_i" btree (i) +> "x_i" btree (xpath_string(x, 'data'::text)) +> "x_ii" btree (xpath_string(x, 'movie/characters/character'::text)) +> Has OIDs: no +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + + +--------------enigB810D5620F6C038341525139 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD4DBQFC0wPKJdeBCYSNAAMRAk14AJdsYOPYY3PHuBNilislLLiqOX11AKCC4Cki +S4ZzdD/Y9WtZEsc0LA+xwA== +=GwKr +-----END PGP SIGNATURE----- + +--------------enigB810D5620F6C038341525139-- + +From pgsql-performance-owner@postgresql.org Mon Jul 11 20:47:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 26E725298D + for ; + Mon, 11 Jul 2005 20:47:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74667-09 + for ; + Mon, 11 Jul 2005 23:47:55 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 637D452987 + for ; + Mon, 11 Jul 2005 20:47:54 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6BNloXr012962; + Mon, 11 Jul 2005 19:47:50 -0400 (EDT) +To: "jobapply" +Cc: pgsql-performance@postgresql.org +Subject: Re: Sorting on longer key is faster ? +In-reply-to: <20050709183842.2EABF52820@svr1.postgresql.org> +References: <20050709183842.2EABF52820@svr1.postgresql.org> +Comments: In-reply-to "jobapply" + message dated "Sat, 09 Jul 2005 22:38:40 +0400" +Date: Mon, 11 Jul 2005 19:47:50 -0400 +Message-ID: <12961.1121125670@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/116 +X-Sequence-Number: 13357 + +"jobapply" writes: +> The 2 queries are almost same, but ORDER BY x||t is FASTER than ORDER BY x.. +> How can that be possible? + +Hmm, how long are the x values? Is it possible many of them are +TOASTed? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 11 22:48:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0841D52848 + for ; + Mon, 11 Jul 2005 22:48:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97422-07 + for ; + Tue, 12 Jul 2005 01:48:49 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id E9ED8529A9 + for ; + Mon, 11 Jul 2005 22:48:47 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050712014852m920060ddae>; Tue, 12 Jul 2005 01:48:52 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id A86C255FEC; Mon, 11 Jul 2005 20:48:51 -0500 (CDT) +Received: from [192.168.1.102] (209-181-211-15.cdrr.qwest.net + [209.181.211.15]) + by juju.arbash-meinel.com (Postfix) with ESMTP id D9C0755F98; + Mon, 11 Jul 2005 20:48:46 -0500 (CDT) +Message-ID: <42D3217C.20703@arbash-meinel.com> +Date: Mon, 11 Jul 2005 20:48:44 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Chris Travers , + Postgresql Performance +Subject: Re: Sorting on longer key is faster ? +References: <20050709183842.2EABF52820@svr1.postgresql.org> + <42D303CA.2020808@arbash-meinel.com> + <42D31613.5020608@metatrontech.com> +In-Reply-To: <42D31613.5020608@metatrontech.com> +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigEDC246B45A7210D61FBECEB2" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/117 +X-Sequence-Number: 13358 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigEDC246B45A7210D61FBECEB2 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Chris Travers wrote: +> John A Meinel wrote: +> +>> jobapply wrote: +>> +>> +>>> The 2 queries are almost same, but ORDER BY x||t is FASTER than ORDER +>>> BY x.. +>>> +>>> How can that be possible? +>>> +>>> Btw: x and x||t are same ordered +>>> +>>> phoeniks=> explain analyze SELECT * FROM test WHERE i<20 ORDER BY x +>>> || t; +>>> QUERY PLAN +>>> +>>> +>> +>> +>> What types are x and t, I have the feeling "x || t" is actually a +>> boolean, so it is only a True/False sort, while ORDER BY x has to do +>> some sort of string comparison (which might actually be a locale +>> depended comparison, and strcoll can be very slow on some locales) +>> +>> +>> +> Am I reading this that wrong? I would think that x || t would mean +> "concatenate x and t." + +Sorry, I think you are right. I was getting my operators mixed up. +> +> This is interesting. I never through of writing a multicolumn sort this +> way.... + +I'm also surprised that the sort is faster with a merge operation. Are +you using UNICODE as the database format? I'm just wondering if it is +doing something funny like casting it to an easier to sort type. + +> +> Best Wishes, +> Chris Travers +> Metatron Technology Consulting + +PS> Don't forget to Reply All so that your messages go back to the list. + +--------------enigEDC246B45A7210D61FBECEB2 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC0yF8JdeBCYSNAAMRAuLoAKCQRpqH4VQrgX1WYAPsdIkhvTGsIgCcDIsH +X59AVC17LTtLbpt8i6BHxaw= +=L2PD +-----END PGP SIGNATURE----- + +--------------enigEDC246B45A7210D61FBECEB2-- + +From pgsql-performance-owner@postgresql.org Mon Jul 11 22:52:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1A08B52977 + for ; + Mon, 11 Jul 2005 22:52:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 00888-03 + for ; + Tue, 12 Jul 2005 01:52:28 +0000 (GMT) +Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) + by svr1.postgresql.org (Postfix) with ESMTP id 4082C52994 + for ; + Mon, 11 Jul 2005 22:52:27 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP + id <20050712015231m9100cftf2e>; Tue, 12 Jul 2005 01:52:32 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 87E3755FEC; Mon, 11 Jul 2005 20:52:31 -0500 (CDT) +Received: from [192.168.1.102] (209-181-211-15.cdrr.qwest.net + [209.181.211.15]) + by juju.arbash-meinel.com (Postfix) with ESMTP id C03F155F98; + Mon, 11 Jul 2005 20:52:27 -0500 (CDT) +Message-ID: <42D32259.2000705@arbash-meinel.com> +Date: Mon, 11 Jul 2005 20:52:25 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: jobapply +Cc: pgsql-performance@postgresql.org +Subject: Re: Sorting on longer key is faster ? +References: <20050709183842.2EABF52820@svr1.postgresql.org> +In-Reply-To: <20050709183842.2EABF52820@svr1.postgresql.org> +X-Enigmail-Version: 0.91.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigBEFD86D74D4F6EC79AD16D69" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/118 +X-Sequence-Number: 13359 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigBEFD86D74D4F6EC79AD16D69 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +jobapply wrote: +> The 2 queries are almost same, but ORDER BY x||t is FASTER than ORDER BY x.. +> +> How can that be possible? +> +> Btw: x and x||t are same ordered +> +> phoeniks=> explain analyze SELECT * FROM test WHERE i<20 ORDER BY x || t; +> QUERY PLAN + +I also thought of another possibility. Are there a lot of similar +entries in X? Meaning that the same value is repeated over and over? It +is possible that the sort code has a weakness when sorting equal values. + +For instance, if it was doing a Hash aggregation, you would have the +same hash repeated. (It isn't I'm just mentioning a case where it might +affect something). + +If it is creating a tree representation, it might cause some sort of +pathological worst-case behavior, where all entries keep adding to the +same side of the tree, rather than being more balanced. + +I don't know the internals of postgresql sorting, but just some ideas. + +John +=:-> + + +--------------enigBEFD86D74D4F6EC79AD16D69 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC0yJZJdeBCYSNAAMRAqNvAJ9ISh6cVjxogvmOiwRfIl4qATHrEgCfetFN +P5ittkgSVxFUPpcfR+AztqU= +=MbUn +-----END PGP SIGNATURE----- + +--------------enigBEFD86D74D4F6EC79AD16D69-- + +From pgsql-performance-owner@postgresql.org Tue Jul 12 18:23:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E17D352BA4 + for ; + Tue, 12 Jul 2005 18:15:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95953-03 + for ; + Tue, 12 Jul 2005 21:15:40 +0000 (GMT) +Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) + by svr1.postgresql.org (Postfix) with ESMTP id E9DCF52BD2 + for ; + Tue, 12 Jul 2005 18:07:47 -0300 (ADT) +Received: from web33902.mail.mud.yahoo.com (web33902.mail.mud.yahoo.com + [66.163.178.66]) + by svr2.postgresql.org (Postfix) with SMTP id C91E1F1178 + for ; + Tue, 12 Jul 2005 07:19:54 +0100 (BST) +Received: (qmail 37245 invoked by uid 60001); 12 Jul 2005 06:22:47 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=uL5maoKeM37Pkbe400pZ+/EUX/fumpdAJmRhtvmRL9BuZCujG1RTNMW9SeSa53aI1c9Ilfi7dhr3rNuTvUDKzgGp4Df/sOea9j2N5GGnxhuLeoP82evkGryU9K7GIcDeySPxnmz0aCR4c2FR1/xHTOR8DX77U5JuF5aSxjWqEts= + ; +Message-ID: <20050712062247.37243.qmail@web33902.mail.mud.yahoo.com> +Received: from [67.106.37.5] by web33902.mail.mud.yahoo.com via HTTP; + Mon, 11 Jul 2005 23:22:47 PDT +Date: Mon, 11 Jul 2005 23:22:47 -0700 (PDT) +From: Brent Henry +Subject: General DB Tuning +To: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, + hits=2.174 tagged_above=0 required=5 tests=FORGED_YAHOO_RCVD +X-Spam-Level: ** +X-Archive-Number: 200507/125 +X-Sequence-Number: 13366 + +Help! After recently migrating to Postgres 8, I've +discovered to my horror that I can't determine which +queries are poorly performing anymore because the +logging has drastically changed and no longer shows +durations for anything done through JDBC. + +So I'm desperately trying to do performance tuning on +my servers and have no way to sort out which +statements are the slowest. + +Does anyone have any suggestions? How do you +determine what queries are behaving badly when you +can't get durations out of the logs? + +I have a perl script that analyzes the output from +Postgres 7 logs and it works great! But it relies on +the duration being there. + +I did some searches on postgresql.org mailing lists +and have seen a few people discussing this problem, +but noone seems to be too worried about it. Is there +a simple work-around? + +Sincerely, + +Brent + + + +____________________________________________________ +Sell on Yahoo! Auctions � no fees. Bid on great items. +http://auctions.yahoo.com/ + +From pgsql-performance-owner@postgresql.org Tue Jul 12 09:58:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 48C8F5281F + for ; + Tue, 12 Jul 2005 09:58:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59884-06 + for ; + Tue, 12 Jul 2005 12:58:03 +0000 (GMT) +Received: from cmailg2.svr.pol.co.uk (cmailg2.svr.pol.co.uk [195.92.195.172]) + by svr1.postgresql.org (Postfix) with ESMTP id A607A52D37 + for ; + Tue, 12 Jul 2005 04:45:41 -0300 (ADT) +Received: from modem-3803.leopard.dialup.pol.co.uk ([217.135.158.219] + helo=192.168.0.102) by cmailg2.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DsFSW-0005Ka-Cb; Tue, 12 Jul 2005 08:45:40 +0100 +Subject: Re: cost-based vacuum +From: Simon Riggs +To: Ian Westmacott +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1121093488.3970.70.camel@localhost.localdomain> +References: <1120839902.20657.197.camel@spectre.intellivid.com> + <1121081504.3970.53.camel@localhost.localdomain> + <1121087266.27427.35.camel@spectre.intellivid.com> + <1121093488.3970.70.camel@localhost.localdomain> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Tue, 12 Jul 2005 08:45:38 +0100 +Message-Id: <1121154338.3970.106.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/119 +X-Sequence-Number: 13360 + +On Mon, 2005-07-11 at 15:51 +0100, Simon Riggs wrote: +> On Mon, 2005-07-11 at 09:07 -0400, Ian Westmacott wrote: +> > On Mon, 2005-07-11 at 07:31, Simon Riggs wrote: +> > > The ANALYZE commands hold read locks on the tables you wish to write to. +> > > If you slow them down, you merely slow down your write transactions +> > > also, and then the read transactions that wait behind them. Every time +> > > the ANALYZE sleeps it wakes up the other transactions, which then +> > > realise they can't move because of locks and then wake up the ANALYZEs +> > > for another shot. The end result is that you introduce more context- +> > > switching, without any chance of doing more useful work while the +> > > ANALYZEs sleep. +> > +> > Let me make sure I understand. ANALYZE acquires a read +> > lock on the table, that it holds until the operation is +> > complete (including any sleeps). That read lock blocks +> > the extension of that table via COPY. Is that right? +> > +> > According to the 8.0 docs, ANALYZE acquires an ACCESS SHARE +> > lock on the table, and that conflicts only with ACCESS +> > EXCLUSIVE. Thats why I didn't think I had a lock issue, +> > since I think COPY only needs ROW EXCLUSIVE. Or perhaps +> > the transaction needs something more? +> +> The docs are correct, but don't show catalog and buffer locks. +> +> ...but on further reading of the code there are no catalog locks or +> buffer locks held across the sleep points. So, my explanation doesn't +> work as an explanation for the sleep/no sleep difference you have +> observed. + +I've been through all the code now and can't find any resource that is +held across a delay point. Nor any reason to believe that the vacuum +cost accounting would slow anything down. + +Since vacuum_cost_delay is a userset parameter, you should be able to +SET this solely for the analyze_thread. That way we will know with more +certainty that it is the analyze_thread that is interfering. + +What is your default_statistics_target? +Do you have other stats targets set? + +How long does ANALYZE take to run, with/without the vacuum_cost_delay? + +Thanks, + +Best Regards, Simon Riggs + + + +From pgsql-performance-owner@postgresql.org Tue Jul 12 11:35:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 910F752946 + for ; + Tue, 12 Jul 2005 11:35:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 82789-02 + for ; + Tue, 12 Jul 2005 14:35:27 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.197.194]) + by svr1.postgresql.org (Postfix) with SMTP id 4515D528A6 + for ; + Tue, 12 Jul 2005 11:35:29 -0300 (ADT) +Received: (qmail 2462 invoked by uid 500); 12 Jul 2005 14:35:52 -0000 +Date: Tue, 12 Jul 2005 09:35:52 -0500 +From: Bruno Wolff III +To: Dario Pudlo +Cc: pgsql-performance@postgresql.org +Subject: Re: join and query planner +Message-ID: <20050712143552.GA32711@wolff.to> +Mail-Followup-To: Bruno Wolff III , + Dario Pudlo , 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.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/120 +X-Sequence-Number: 13361 + +On Wed, Jul 06, 2005 at 18:54:02 -0300, + Dario Pudlo wrote: +> (first at all, sorry for my english) +> Hi. +> - Does "left join" restrict the order in which the planner must join +> tables? I've read about join, but i'm not sure about left join... + +The left join operator is not associative so in general the planner doesn't +have much flexibility to reorder left (or right) joins. + +From pgsql-performance-owner@postgresql.org Tue Jul 12 13:22:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 165DA5294F + for ; + Tue, 12 Jul 2005 13:22:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 05612-06 + for ; + Tue, 12 Jul 2005 16:22:00 +0000 (GMT) +Received: from adicia.telenet-ops.be (adicia.telenet-ops.be [195.130.132.56]) + by svr1.postgresql.org (Postfix) with ESMTP id 4B56C52867 + for ; + Tue, 12 Jul 2005 13:21:56 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by adicia.telenet-ops.be (Postfix) with SMTP id B521D44180 + for ; + Tue, 12 Jul 2005 18:21:52 +0200 (MEST) +Received: from [10.0.1.2] (d5152B1F3.access.telenet.be [81.82.177.243]) + by adicia.telenet-ops.be (Postfix) with ESMTP id 2AB6244061 + for ; + Tue, 12 Jul 2005 18:21:52 +0200 (MEST) +Mime-Version: 1.0 (Apple Message framework v622) +To: pgsql-performance@postgresql.org +Message-Id: +Content-Type: multipart/mixed; boundary=Apple-Mail-36--1003286864 +From: Yves Vindevogel +Subject: Projecting currentdb to more users +Date: Tue, 12 Jul 2005 18:21:57 +0200 +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/121 +X-Sequence-Number: 13362 + + +--Apple-Mail-36--1003286864 +Content-Type: multipart/alternative; + boundary=Apple-Mail-37--1003286864 + + +--Apple-Mail-37--1003286864 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/plain; + charset=ISO-8859-1; + format=flowed + +Hi, + +We have a couple of database that are identical (one for each customer). +They are all relatively small, ranging from 100k records to 1m records. +There's only one main table with some smaller tables, a lot of indexes=20= + +and some functions. + +I would like to make an estimation of the performance, the diskspace=20 +and other related things, +when we have database of for instance 10 million records or 100 million=20= + +records. + +Is there any math to be done on that ? + +Met vriendelijke groeten, +Bien =E0 vous, +Kind regards, + +Yves Vindevogel +Implements + + +--Apple-Mail-37--1003286864 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/enriched; + charset=ISO-8859-1 + +Hi, + + +We have a couple of database that are identical (one for each +customer). + +They are all relatively small, ranging from 100k records to 1m records. + +There's only one main table with some smaller tables, a lot of indexes +and some functions. + + +I would like to make an estimation of the performance, the diskspace +and other related things,=20 + +when we have database of for instance 10 million records or 100 +million records. + + +Is there any math to be done on that ? + + +Met vriendelijke groeten, + +Bien =E0 vous, + +Kind regards, + + +Yves Vindevogel + +Implements + + + += + +--Apple-Mail-37--1003286864-- + +--Apple-Mail-36--1003286864 +Content-Transfer-Encoding: base64 +Content-Type: image/tiff; + x-unix-mode=0666; + name="Pasted Graphic 2.tiff" +Content-Disposition: inline; + filename="Pasted Graphic 2.tiff" + +TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP +8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho +9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ +RNtO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AERAAQA +AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb +AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA +CAAK/IAAACcQAAr8gAAAJxA= + +--Apple-Mail-36--1003286864 +Content-Type: multipart/alternative; + boundary=Apple-Mail-38--1003286863 + + +--Apple-Mail-38--1003286863 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + format=flowed + + + +Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 + +Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 + +Web: http://www.implements.be + +First they ignore you. Then they laugh at you. Then they fight you. +Then you win. +Mahatma Ghandi. +--Apple-Mail-38--1003286863 +Content-Transfer-Encoding: 7bit +Content-Type: text/enriched; + charset=US-ASCII + + + + +Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 + + +Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 + + +Web: http://www.implements.be + + + +First they ignore you. Then they laugh at you. Then they fight you. +Then you win. + +Mahatma Ghandi. +--Apple-Mail-38--1003286863-- + +--Apple-Mail-36--1003286864-- + + +From pgsql-performance-owner@postgresql.org Tue Jul 12 14:51:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E4B2352A2C + for ; + Tue, 12 Jul 2005 14:50:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25938-10 + for ; + Tue, 12 Jul 2005 17:50:53 +0000 (GMT) +Received: from mailhost.intellivid.com (mailhost.intellivid.com + [64.32.200.11]) + by svr1.postgresql.org (Postfix) with ESMTP id 123EF5283C + for ; + Tue, 12 Jul 2005 14:50:52 -0300 (ADT) +Received: from [192.168.2.68] (spectre.intellivid.com [192.168.2.68]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (Client did not present a certificate) + by newmail.intellivid.com (Postfix) with ESMTP id E7B73F1829E; + Tue, 12 Jul 2005 13:50:51 -0400 (EDT) +Subject: Re: cost-based vacuum +From: Ian Westmacott +To: Simon Riggs +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1121154338.3970.106.camel@localhost.localdomain> +References: <1120839902.20657.197.camel@spectre.intellivid.com> + <1121081504.3970.53.camel@localhost.localdomain> + <1121087266.27427.35.camel@spectre.intellivid.com> + <1121093488.3970.70.camel@localhost.localdomain> + <1121154338.3970.106.camel@localhost.localdomain> +Content-Type: text/plain +Organization: Intellivid Corp. +Message-Id: <1121190651.10346.342.camel@spectre.intellivid.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 +Date: Tue, 12 Jul 2005 13:50:51 -0400 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/122 +X-Sequence-Number: 13363 + +On Tue, 2005-07-12 at 03:45, Simon Riggs wrote: +> Since vacuum_cost_delay is a userset parameter, you should be able to +> SET this solely for the analyze_thread. That way we will know with more +> certainty that it is the analyze_thread that is interfering. + +That is what I have been doing. In fact, I have eliminated +the reader_thread and analyze_thread. I just have the +writer_thread running, and a psql connection with which I +perform ANALYZE, for various vacuum_cost_* parameters. +(I'm trying to extract a reproducible experiment) + +It appears not to matter whether it is one of the tables +being written to that is ANALYZEd. I can ANALYZE an old, +quiescent table, or a system table and see this effect. + +> What is your default_statistics_target? + +All other configs are default; default_statistics_target=10. + +> Do you have other stats targets set? + +No. The only thing slightly out of the ordinary with the +tables is that they are created WITHOUT OIDS. Some indexes, +but no primary keys. All columns NOT NULL. + +> How long does ANALYZE take to run, with/without the vacuum_cost_delay? + +Well, on one table with about 50K rows, it takes about 1/4s +to ANALYZE with vacuum_cost_delay=0, and about 15s with +vacuum_cost_delay=1000. + +Other things of note: + +- VACUUM has the same effect. If I VACUUM or ANALYZE the + whole DB, the CPU spikes reset between tables. +- vmstat reports blocks written drops as the CPU rises. + Don't know if it is cause or effect yet. On a small test + system, I'm writing about 1.5MB/s. After about 20s + of cost-based ANALYZE, this drops under 0.5MB/s. +- this is a dual Xeon. I have tried both with and without + hyperthreading. I haven't tried to reproduce it + elsewhere yet, but will. +- Looking at oprofile reports for 10-minute runs of a + database-wide VACUUM with vacuum_cost_delay=0 and 1000, + shows the latter spending a lot of time in LWLockAcquire + and LWLockRelease (20% each vs. 2%). + + +Thanks, + + --Ian + + + +From pgsql-performance-owner@postgresql.org Tue Jul 12 15:01:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E723752A7B + for ; + Tue, 12 Jul 2005 15:01:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 29766-05 + for ; + Tue, 12 Jul 2005 18:00:50 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 9845752A2C + for ; + Tue, 12 Jul 2005 15:00:49 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 71so8059wra + for ; + Tue, 12 Jul 2005 11:00:50 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=HAJcu+o9+qAhSOaA1JM+cpPsdvf92FdqCF+Rs1PROlRtFquyWg1x46tuQOfTbyU1H5hzbdW8RKRpajP2piuzpZWHGkgkxmE7owzf+y0dt/kD5WLXUJBrOGKB2zm4n9dqrjgx2kuiQIru5doXEQyrPQ6AK2dBYpf4L0PPav95Ovs= +Received: by 10.54.106.13 with SMTP id e13mr31902wrc; + Tue, 12 Jul 2005 11:00:49 -0700 (PDT) +Received: by 10.54.22.15 with HTTP; Tue, 12 Jul 2005 11:00:49 -0700 (PDT) +Message-ID: +Date: Tue, 12 Jul 2005 13:00:49 -0500 +From: Matthew Nuzum +Reply-To: newz@bearfruit.org +To: Yves Vindevogel +Subject: Re: Projecting currentdb to more users +Cc: pgsql-performance@postgresql.org +In-Reply-To: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.985 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP, + RCVD_IN_BL_SPAMCOP_NET +X-Spam-Level: +X-Archive-Number: 200507/123 +X-Sequence-Number: 13364 + +On 7/12/05, Yves Vindevogel wrote: +> Hi, +>=20 +> We have a couple of database that are identical (one for each customer). +> They are all relatively small, ranging from 100k records to 1m records. +> There's only one main table with some smaller tables, a lot of indexes +> and some functions. +>=20 +> I would like to make an estimation of the performance, the diskspace +> and other related things, +> when we have database of for instance 10 million records or 100 million +> records. +>=20 +> Is there any math to be done on that ? + +Its pretty easy to make a database run fast with only a few thousand +records, or even a million records, however things start to slow down +non-linearly when the database grows too big to fit in RAM. + +I'm not a guru, but my attempts to do this have not been very accurate. + +Maybe (just maybe) you could get an idea by disabling the OS cache on +the file system(s) holding the database and then somehow fragmenting +the drive severly (maybe by putting each table in it's own disk +partition?!?) and measuring performance. + +On the positive side, there are a lot of wise people on this list who +have +++ experience optimzing slow queries on big databases. So +queries now that run in 20 ms but slow down to 7 seconds when your +tables grow will likely benefit from optimizing. +--=20 +Matthew Nuzum +www.bearfruit.org + +From pgsql-general-owner@postgresql.org Tue Jul 12 15:25:53 2005 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 21E6252A74 + for ; + Tue, 12 Jul 2005 15:25:52 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40449-01 + for ; + Tue, 12 Jul 2005 18:25:33 +0000 (GMT) +Received: from imail02.thexchange.com (imail.arbinet.com [64.74.47.121]) + by svr1.postgresql.org (Postfix) with ESMTP id 252DC52A1D + for ; + Tue, 12 Jul 2005 15:25:32 -0300 (ADT) +Received: from imail02.thexchange.com (localhost [127.0.0.1]) + by imail02.thexchange.com (8.12.10/8.12.2) with ESMTP id j6CIekBu008128 + for ; Tue, 12 Jul 2005 18:40:46 GMT +Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) + by imail02.thexchange.com (8.12.2/8.12.2) with SMTP id j6CIejdA008125; + Tue, 12 Jul 2005 18:40:45 GMT +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Re: [PERFORM] Projecting currentdb to more users +Date: Tue, 12 Jul 2005 18:24:52 -0000 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Projecting currentdb to more users +Thread-Index: AcWHC/l3wnTfUa+vQi6A9Zbm3m7FswAAudvA +From: "Mohan, Ross" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.11 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/328 +X-Sequence-Number: 80426 + + From AMD's suit against Intel. Perhaps relevant to some PG/AMD issues.=20 + +"...125. Intel has designed its compiler purposely to degrade = +performance when a program +is run on an AMD platform. To achieve this, Intel designed the compiler = +to compile code +along several alternate code paths. Some paths are executed when the = +program runs on an Intel +platform and others are executed when the program is operated on a = +computer with an AMD +microprocessor. (The choice of code path is determined when the program = +is started, using a +feature known as "CPUID" which identifies the computer's = +microprocessor.) By design, the +code paths were not created equally. If the program detects a "Genuine = +Intel" microprocessor, +it executes a fully optimized code path and operates with the maximum = +efficiency. However, +if the program detects an "Authentic AMD" microprocessor, it executes a = +different code path +that will degrade the program's performance or cause it to crash..." + + +From pgsql-general-owner@postgresql.org Tue Jul 12 15:41:17 2005 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0358152A80 + for ; + Tue, 12 Jul 2005 15:41:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42972-04 + for ; + Tue, 12 Jul 2005 18:41:14 +0000 (GMT) +Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) + by svr1.postgresql.org (Postfix) with ESMTP id 7C51252A88 + for ; + Tue, 12 Jul 2005 15:41:14 -0300 (ADT) +Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP + with MS-WebStorage 6.5.6944 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 12 Jul 2005 13:41:14 -0500 +Subject: Re: [PERFORM] Projecting currentdb to more users +From: Scott Marlowe +To: "Mohan, Ross" +Cc: pgsql-general@postgresql.org +In-Reply-To: + +References: +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1121193674.8208.236.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Tue, 12 Jul 2005 13:41:14 -0500 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/332 +X-Sequence-Number: 80430 + +On Tue, 2005-07-12 at 13:24, Mohan, Ross wrote: +> From AMD's suit against Intel. Perhaps relevant to some PG/AMD issues. +> +> "...125. Intel has designed its compiler purposely to degrade performance when a program +> is run on an AMD platform. To achieve this, Intel designed the compiler to compile code +> along several alternate code paths. Some paths are executed when the program runs on an Intel +> platform and others are executed when the program is operated on a computer with an AMD +> microprocessor. (The choice of code path is determined when the program is started, using a +> feature known as "CPUID" which identifies the computer's microprocessor.) By design, the +> code paths were not created equally. If the program detects a "Genuine Intel" microprocessor, +> it executes a fully optimized code path and operates with the maximum efficiency. However, +> if the program detects an "Authentic AMD" microprocessor, it executes a different code path +> that will degrade the program's performance or cause it to crash..." + +Well, this is, right now, just AMD's supposition about Intel's +behaviour, I'm not sure one way or the other if Intel IS doing this. +Being a big, money hungry company, I wouldn't be surprised if they are, +but I don't think it would affect postgresql for most people, since they +would be using the gcc compiler. + +From pgsql-general-owner@postgresql.org Tue Jul 12 17:06:29 2005 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 48BB252968 + for ; + Tue, 12 Jul 2005 17:06:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68716-01 + for ; + Tue, 12 Jul 2005 20:06:14 +0000 (GMT) +Received: from rutherford.zen.co.uk (rutherford.zen.co.uk [212.23.3.142]) + by svr1.postgresql.org (Postfix) with ESMTP id 71E39529F1 + for ; + Tue, 12 Jul 2005 17:06:13 -0300 (ADT) +Received: from [62.3.112.246] (helo=gweek.purplebat.com) + by rutherford.zen.co.uk with esmtp (Exim 4.34) + id 1DsR18-0003tP-7N; Tue, 12 Jul 2005 20:06:10 +0000 +Received: from mrae by gweek.purplebat.com with local (Exim 3.36 #1 (Debian)) + id 1DsR17-0006WK-00; Tue, 12 Jul 2005 21:06:09 +0100 +Date: Tue, 12 Jul 2005 21:06:09 +0100 +To: Scott Marlowe +Cc: "Mohan, Ross" , pgsql-general@postgresql.org +Subject: Re: [PERFORM] Projecting currentdb to more users +Message-ID: <20050712200609.GA24958@purplebat.com> +References: + <1121193674.8208.236.camel@state.g2switchworks.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1121193674.8208.236.camel@state.g2switchworks.com> +User-Agent: Mutt/1.5.9i +From: Mark Rae +X-Originating-Rutherford-IP: [62.3.112.246] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.033 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/347 +X-Sequence-Number: 80445 + +On Tue, Jul 12, 2005 at 01:41:14PM -0500, Scott Marlowe wrote: +> On Tue, 2005-07-12 at 13:24, Mohan, Ross wrote: +> > From AMD's suit against Intel. Perhaps relevant to some PG/AMD issues. +> Well, this is, right now, just AMD's supposition about Intel's +> behaviour, I'm not sure one way or the other if Intel IS doing this. + +I think its more a case of AMD now having solid evidence to back +up the claims. + +This discovery, and that fact that you could get round it by +toggling some flags, was being discussed on various HPC mailing +lists around about the beginning of this year. + + -Mark + + +From pgsql-general-owner@postgresql.org Tue Jul 12 17:11:45 2005 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D8FBB529BF + for ; + Tue, 12 Jul 2005 17:11:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66866-06 + for ; + Tue, 12 Jul 2005 20:11:35 +0000 (GMT) +Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) + by svr1.postgresql.org (Postfix) with ESMTP id E768E52968 + for ; + Tue, 12 Jul 2005 17:11:34 -0300 (ADT) +Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP + with MS-WebStorage 6.5.6944 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 12 Jul 2005 15:11:35 -0500 +Subject: Re: [PERFORM] Projecting currentdb to more users +From: Scott Marlowe +To: Mark Rae +Cc: "Mohan, Ross" , pgsql-general@postgresql.org +In-Reply-To: <20050712200609.GA24958@purplebat.com> +References: + <1121193674.8208.236.camel@state.g2switchworks.com> + <20050712200609.GA24958@purplebat.com> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1121199095.8208.245.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Tue, 12 Jul 2005 15:11:35 -0500 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/348 +X-Sequence-Number: 80446 + +On Tue, 2005-07-12 at 15:06, Mark Rae wrote: +> On Tue, Jul 12, 2005 at 01:41:14PM -0500, Scott Marlowe wrote: +> > On Tue, 2005-07-12 at 13:24, Mohan, Ross wrote: +> > > From AMD's suit against Intel. Perhaps relevant to some PG/AMD issues. +> > Well, this is, right now, just AMD's supposition about Intel's +> > behaviour, I'm not sure one way or the other if Intel IS doing this. +> +> I think its more a case of AMD now having solid evidence to back +> up the claims. +> +> This discovery, and that fact that you could get round it by +> toggling some flags, was being discussed on various HPC mailing +> lists around about the beginning of this year. + +Wow! That's pretty fascinating. So, is the evidence pretty +overwhelming that this was not simple incompetence, but real malice? + +I could see either one being a cause of this issue, and wouldn't really +be surprised by either one. + +From pgsql-general-owner@postgresql.org Tue Jul 12 17:32:25 2005 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A5E04529A1 + for ; + Tue, 12 Jul 2005 17:32:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 77817-04 + for ; + Tue, 12 Jul 2005 20:32:15 +0000 (GMT) +Received: from pythagoras.zen.co.uk (pythagoras.zen.co.uk [212.23.3.140]) + by svr1.postgresql.org (Postfix) with ESMTP id B614D52968 + for ; + Tue, 12 Jul 2005 17:32:14 -0300 (ADT) +Received: from [62.3.112.246] (helo=gweek.purplebat.com) + by pythagoras.zen.co.uk with esmtp (Exim 4.30) + id 1DsRQL-0002vw-So; Tue, 12 Jul 2005 20:32:13 +0000 +Received: from mrae by gweek.purplebat.com with local (Exim 3.36 #1 (Debian)) + id 1DsRQL-0006YZ-00; Tue, 12 Jul 2005 21:32:13 +0100 +Date: Tue, 12 Jul 2005 21:32:13 +0100 +To: Scott Marlowe +Cc: "Mohan, Ross" , pgsql-general@postgresql.org +Subject: Re: [PERFORM] Projecting currentdb to more users +Message-ID: <20050712203213.GB24958@purplebat.com> +References: + <1121193674.8208.236.camel@state.g2switchworks.com> + <20050712200609.GA24958@purplebat.com> + <1121199095.8208.245.camel@state.g2switchworks.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1121199095.8208.245.camel@state.g2switchworks.com> +User-Agent: Mutt/1.5.9i +From: Mark Rae +X-Originating-Pythagoras-IP: [62.3.112.246] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.033 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/352 +X-Sequence-Number: 80450 + +On Tue, Jul 12, 2005 at 03:11:35PM -0500, Scott Marlowe wrote: +> On Tue, 2005-07-12 at 15:06, Mark Rae wrote: +> > I think its more a case of AMD now having solid evidence to back +> > up the claims. +> +> Wow! That's pretty fascinating. So, is the evidence pretty +> overwhelming that this was not simple incompetence, but real malice? + + +I suppose that depends on the exact nature of the 'check'. + +As far as I was aware it was more a case of 'I don't recognise this +processor, so I'll do it the slow but safe way'. + +However from what AMD are claiming, it seems to be more of a +'Its an AMD processor so I'll be deliberately slow and buggy' + + +Having said that, I have tried compiling PG with the intel compiler +in the past, and haven't noticed any real difference. But in a database +there isn't much scope for vectorization and pipelining +compared with numerical code, which is where the Intel compiler +makes the greatest difference. + + -Mark + +From pgsql-performance-owner@postgresql.org Tue Jul 12 18:54:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E478E52AFD + for ; + Tue, 12 Jul 2005 18:54:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07286-02 + for ; + Tue, 12 Jul 2005 21:54:41 +0000 (GMT) +Received: from mail.jobflash.com (oncallweb2.jobflash.com [64.62.211.41]) + by svr1.postgresql.org (Postfix) with ESMTP id 9974952ACC + for ; + Tue, 12 Jul 2005 18:54:40 -0300 (ADT) +Received: from [192.168.2.22] (user-38lc18a.dialup.mindspring.com + [209.86.5.10]) + by mail.jobflash.com (Postfix) with ESMTP id 883DC420E4; + Tue, 12 Jul 2005 14:54:41 -0700 (PDT) +Message-ID: <42D43C17.90005@jobflash.com> +Date: Tue, 12 Jul 2005 14:54:31 -0700 +From: Tom Arthurs +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Brent Henry +Cc: pgsql-performance@postgresql.org +Subject: Re: General DB Tuning +References: <20050712062247.37243.qmail@web33902.mail.mud.yahoo.com> +In-Reply-To: <20050712062247.37243.qmail@web33902.mail.mud.yahoo.com> +Content-Type: text/plain; charset=windows-1252; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/126 +X-Sequence-Number: 13367 + +I have this in my postgresql.conf file and it works fine (set the min to +whatever you want to log) +log_min_duration_statement = 3000 # -1 is disabled, in milliseconds. + +Another setting that might get what you want: + +#log_duration = false + +uncomment and change to true. + + From the docs: +(http://www.postgresql.org/docs/8.0/interactive/runtime-config.html) + + Causes the duration of every completed statement which satisfies +log_statement to be logged. When using this option, if you are not using +syslog, it is recommended that you log the PID or session ID using +log_line_prefix so that you can link the statement to the duration using +the process ID or session ID. The default is off. Only superusers can +change this setting. + +Brent Henry wrote: +> Help! After recently migrating to Postgres 8, I've +> discovered to my horror that I can't determine which +> queries are poorly performing anymore because the +> logging has drastically changed and no longer shows +> durations for anything done through JDBC. +> +> So I'm desperately trying to do performance tuning on +> my servers and have no way to sort out which +> statements are the slowest. +> +> Does anyone have any suggestions? How do you +> determine what queries are behaving badly when you +> can't get durations out of the logs? +> +> I have a perl script that analyzes the output from +> Postgres 7 logs and it works great! But it relies on +> the duration being there. +> +> I did some searches on postgresql.org mailing lists +> and have seen a few people discussing this problem, +> but noone seems to be too worried about it. Is there +> a simple work-around? +> +> Sincerely, +> +> Brent +> +> +> +> ____________________________________________________ +> Sell on Yahoo! Auctions � no fees. Bid on great items. +> http://auctions.yahoo.com/ +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: don't forget to increase your free space map settings +> +> +> + +From pgsql-performance-owner@postgresql.org Tue Jul 12 20:32:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DAB6D52AD2 + for ; + Tue, 12 Jul 2005 20:32:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 26593-08 + for ; + Tue, 12 Jul 2005 23:32:32 +0000 (GMT) +Received: from web33901.mail.mud.yahoo.com (web33901.mail.mud.yahoo.com + [66.163.178.65]) + by svr1.postgresql.org (Postfix) with SMTP id 92CF252ACE + for ; + Tue, 12 Jul 2005 20:32:30 -0300 (ADT) +Received: (qmail 5468 invoked by uid 60001); 12 Jul 2005 23:32:30 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=tRlxZBNqo0nFert/UevCiQarJFH9FX68N2hz1J4K4wwGvFVabe2P97L84LJ3Lpy/huvVlvVvZDpNtwaqqXUYq43On0+9PPwLBxBjVsa6rQKWKJ0CZiUvQjCiqxS+MY4X0Vw9mAnbfhe8r7q83JEW/vNVMM4cR6tqrOwfFEIvC/c= + ; +Message-ID: <20050712233230.5466.qmail@web33901.mail.mud.yahoo.com> +Received: from [67.106.37.5] by web33901.mail.mud.yahoo.com via HTTP; + Tue, 12 Jul 2005 16:32:30 PDT +Date: Tue, 12 Jul 2005 16:32:30 -0700 (PDT) +From: Brent Henry +Subject: Re: General DB Tuning +To: Tom Arthurs +Cc: pgsql-performance@postgresql.org +In-Reply-To: <42D43C17.90005@jobflash.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, + hits=2.174 tagged_above=0 required=5 tests=FORGED_YAHOO_RCVD +X-Spam-Level: ** +X-Archive-Number: 200507/127 +X-Sequence-Number: 13368 + +Yes, that is exactly what I want to use! + +Unfortunately, it doesn't work if you access postgres +through a JDBC connection. I don't know why. I found +a posting from back in February which talks aobut this +a little: + +http://archives.postgresql.org/pgsql-admin/2005-02/msg00055.php + +But I can't find anywhere where someone has fixed it. +Am I the only one accessing postgres through JDBC? + +-Brent + + +--- Tom Arthurs wrote: + +> I have this in my postgresql.conf file and it works +> fine (set the min to +> whatever you want to log) +> log_min_duration_statement = 3000 # -1 is disabled, +> in milliseconds. +> +> Another setting that might get what you want: +> +> #log_duration = false +> +> uncomment and change to true. +> +> From the docs: +> +(http://www.postgresql.org/docs/8.0/interactive/runtime-config.html) +> +> Causes the duration of every completed statement +> which satisfies +> log_statement to be logged. When using this option, +> if you are not using +> syslog, it is recommended that you log the PID or +> session ID using +> log_line_prefix so that you can link the statement +> to the duration using +> the process ID or session ID. The default is off. +> Only superusers can +> change this setting. +> +> Brent Henry wrote: +> > Help! After recently migrating to Postgres 8, +> I've +> > discovered to my horror that I can't determine +> which +> > queries are poorly performing anymore because the +> > logging has drastically changed and no longer +> shows +> > durations for anything done through JDBC. +> > +> > So I'm desperately trying to do performance tuning +> on +> > my servers and have no way to sort out which +> > statements are the slowest. +> > +> > Does anyone have any suggestions? How do you +> > determine what queries are behaving badly when you +> > can't get durations out of the logs? +> > +> > I have a perl script that analyzes the output from +> > Postgres 7 logs and it works great! But it relies +> on +> > the duration being there. +> > +> > I did some searches on postgresql.org mailing +> lists +> > and have seen a few people discussing this +> problem, +> > but noone seems to be too worried about it. Is +> there +> > a simple work-around? +> > +> > Sincerely, +> > +> > Brent +> > +> > +> > +> > +> ____________________________________________________ +> > Sell on Yahoo! Auctions � no fees. Bid on great +> items. +> > http://auctions.yahoo.com/ +> > +> > ---------------------------(end of +> broadcast)--------------------------- +> > TIP 5: don't forget to increase your free space +> map settings +> > +> > +> > +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster +> + + +__________________________________________________ +Do You Yahoo!? +Tired of spam? Yahoo! Mail has the best spam protection around +http://mail.yahoo.com + +From pgsql-performance-owner@postgresql.org Tue Jul 12 21:37:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D1A35529B3 + for ; + Tue, 12 Jul 2005 21:37:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42775-02 + for ; + Wed, 13 Jul 2005 00:36:53 +0000 (GMT) +Received: from mail.jobflash.com (oncallweb2.jobflash.com [64.62.211.41]) + by svr1.postgresql.org (Postfix) with ESMTP id 5436D52A11 + for ; + Tue, 12 Jul 2005 21:36:52 -0300 (ADT) +Received: from [192.168.2.22] (user-38lc18a.dialup.mindspring.com + [209.86.5.10]) + by mail.jobflash.com (Postfix) with ESMTP id 278C8420E3; + Tue, 12 Jul 2005 17:36:55 -0700 (PDT) +Message-ID: <42D4621D.4060803@jobflash.com> +Date: Tue, 12 Jul 2005 17:36:45 -0700 +From: Tom Arthurs +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Brent Henry +Cc: pgsql-performance@postgresql.org +Subject: Re: General DB Tuning +References: <20050712233230.5466.qmail@web33901.mail.mud.yahoo.com> +In-Reply-To: <20050712233230.5466.qmail@web33901.mail.mud.yahoo.com> +Content-Type: text/plain; charset=windows-1252; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/128 +X-Sequence-Number: 13369 + +we are using jdbc -- the "log_min_duration_statement = 3000 " statement +works fine for me. Looks like there's no other work around for the +bug(?). Not sure since I have no interest in logging a million +statements a day, I only want to see the poorly performing hits. + +Brent Henry wrote: +> Yes, that is exactly what I want to use! +> +> Unfortunately, it doesn't work if you access postgres +> through a JDBC connection. I don't know why. I found +> a posting from back in February which talks aobut this +> a little: +> +> http://archives.postgresql.org/pgsql-admin/2005-02/msg00055.php +> +> But I can't find anywhere where someone has fixed it. +> Am I the only one accessing postgres through JDBC? +> +> -Brent +> +> +> --- Tom Arthurs wrote: +> +> +>>I have this in my postgresql.conf file and it works +>>fine (set the min to +>>whatever you want to log) +>>log_min_duration_statement = 3000 # -1 is disabled, +>>in milliseconds. +>> +>>Another setting that might get what you want: +>> +>>#log_duration = false +>> +>>uncomment and change to true. +>> +>> From the docs: +>> +> +> (http://www.postgresql.org/docs/8.0/interactive/runtime-config.html) +> +>> Causes the duration of every completed statement +>>which satisfies +>>log_statement to be logged. When using this option, +>>if you are not using +>>syslog, it is recommended that you log the PID or +>>session ID using +>>log_line_prefix so that you can link the statement +>>to the duration using +>>the process ID or session ID. The default is off. +>>Only superusers can +>>change this setting. +>> +>>Brent Henry wrote: +>> +>>>Help! After recently migrating to Postgres 8, +>> +>>I've +>> +>>>discovered to my horror that I can't determine +>> +>>which +>> +>>>queries are poorly performing anymore because the +>>>logging has drastically changed and no longer +>> +>>shows +>> +>>>durations for anything done through JDBC. +>>> +>>>So I'm desperately trying to do performance tuning +>> +>>on +>> +>>>my servers and have no way to sort out which +>>>statements are the slowest. +>>> +>>>Does anyone have any suggestions? How do you +>>>determine what queries are behaving badly when you +>>>can't get durations out of the logs? +>>> +>>>I have a perl script that analyzes the output from +>>>Postgres 7 logs and it works great! But it relies +>> +>>on +>> +>>>the duration being there. +>>> +>>>I did some searches on postgresql.org mailing +>> +>>lists +>> +>>>and have seen a few people discussing this +>> +>>problem, +>> +>>>but noone seems to be too worried about it. Is +>> +>>there +>> +>>>a simple work-around? +>>> +>>>Sincerely, +>>> +>>>Brent +>>> +>>> +>>> +>>> +>> +>>____________________________________________________ +>> +>>>Sell on Yahoo! Auctions � no fees. Bid on great +>> +>>items. +>> +>>>http://auctions.yahoo.com/ +>>> +>>>---------------------------(end of +>> +>>broadcast)--------------------------- +>> +>>>TIP 5: don't forget to increase your free space +>> +>>map settings +>> +>>> +>>> +>>---------------------------(end of +>>broadcast)--------------------------- +>>TIP 2: Don't 'kill -9' the postmaster +>> +> +> +> +> __________________________________________________ +> Do You Yahoo!? +> Tired of spam? Yahoo! Mail has the best spam protection around +> http://mail.yahoo.com +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend +> +> +> + +From pgsql-performance-owner@postgresql.org Tue Jul 12 22:05:23 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E3987529E2 + for ; + Tue, 12 Jul 2005 22:05:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58266-06 + for ; + Wed, 13 Jul 2005 01:05:13 +0000 (GMT) +Received: from lakermmtao09.cox.net (lakermmtao09.cox.net [68.230.240.30]) + by svr1.postgresql.org (Postfix) with ESMTP id A46C752A0F + for ; + Tue, 12 Jul 2005 22:05:11 -0300 (ADT) +Received: from [127.0.0.1] (really [68.3.22.74]) by lakermmtao09.cox.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050713010513.KULZ15825.lakermmtao09.cox.net@[127.0.0.1]> + for ; + Tue, 12 Jul 2005 21:05:13 -0400 +Message-ID: <42D468C9.9070200@works4me.com> +Date: Tue, 12 Jul 2005 18:05:13 -0700 +From: Dennis +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: General DB Tuning +References: <20050712233230.5466.qmail@web33901.mail.mud.yahoo.com> + <42D4621D.4060803@jobflash.com> +In-Reply-To: <42D4621D.4060803@jobflash.com> +Content-Type: text/plain; charset=windows-1252; format=flowed +Content-Transfer-Encoding: 7bit +X-Antivirus: avast! (VPS 0528-2, 07/12/2005), Outbound message +X-Antivirus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/129 +X-Sequence-Number: 13370 + +Tom Arthurs wrote: + +> we are using jdbc -- the "log_min_duration_statement = 3000 " +> statement works fine for me. Looks like there's no other work around +> for the bug(?). Not sure since I have no interest in logging a +> million statements a day, I only want to see the poorly performing hits. + + +Doesn't it depend on what jdbc driver you are using? + +Dennis + +From pgsql-performance-owner@postgresql.org Tue Jul 12 22:14:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B59552802 + for ; + Tue, 12 Jul 2005 22:14:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57461-07 + for ; + Wed, 13 Jul 2005 01:14:37 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 0168752965 + for ; + Tue, 12 Jul 2005 22:14:33 -0300 (ADT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 97D5824FE1; + Wed, 13 Jul 2005 09:14:33 +0800 (WST) +Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 7E63124FE0; + Wed, 13 Jul 2005 09:14:33 +0800 (WST) +Message-ID: <42D46BC4.2010907@familyhealth.com.au> +Date: Wed, 13 Jul 2005 09:17:56 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dennis +Cc: pgsql-performance@postgresql.org +Subject: Re: General DB Tuning +References: <20050712233230.5466.qmail@web33901.mail.mud.yahoo.com> + <42D4621D.4060803@jobflash.com> <42D468C9.9070200@works4me.com> +In-Reply-To: <42D468C9.9070200@works4me.com> +Content-Type: text/plain; charset=windows-1252; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.063 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/130 +X-Sequence-Number: 13371 + +>> we are using jdbc -- the "log_min_duration_statement = 3000 " +>> statement works fine for me. Looks like there's no other work around +>> for the bug(?). Not sure since I have no interest in logging a +>> million statements a day, I only want to see the poorly performing hits. +> +> Doesn't it depend on what jdbc driver you are using? + +It depends if he's using new-protocol prepared queries which don't get +logged properly. Wasn't that fixed for 8.1 or something? + +Chris + + +From pgsql-performance-owner@postgresql.org Tue Jul 12 22:30:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E81AA5281B + for ; + Tue, 12 Jul 2005 22:30:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60646-10 + for ; + Wed, 13 Jul 2005 01:30:21 +0000 (GMT) +Received: from mail.jobflash.com (oncallweb2.jobflash.com [64.62.211.41]) + by svr1.postgresql.org (Postfix) with ESMTP id 216EC529C2 + for ; + Tue, 12 Jul 2005 22:30:20 -0300 (ADT) +Received: from [192.168.2.22] (user-38lc18a.dialup.mindspring.com + [209.86.5.10]) + by mail.jobflash.com (Postfix) with ESMTP id 49003420CF; + Tue, 12 Jul 2005 18:30:24 -0700 (PDT) +Message-ID: <42D46EA6.605@jobflash.com> +Date: Tue, 12 Jul 2005 18:30:14 -0700 +From: Tom Arthurs +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dennis +Cc: pgsql-performance@postgresql.org +Subject: Re: General DB Tuning +References: <20050712233230.5466.qmail@web33901.mail.mud.yahoo.com> + <42D4621D.4060803@jobflash.com> <42D468C9.9070200@works4me.com> +In-Reply-To: <42D468C9.9070200@works4me.com> +Content-Type: text/plain; charset=windows-1252; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/131 +X-Sequence-Number: 13372 + +hmm, yea maybe -- we are using the 7.4 driver with 8.0.x db. + +Dennis wrote: +> Tom Arthurs wrote: +> +>> we are using jdbc -- the "log_min_duration_statement = 3000 " +>> statement works fine for me. Looks like there's no other work around +>> for the bug(?). Not sure since I have no interest in logging a +>> million statements a day, I only want to see the poorly performing hits. +> +> +> +> Doesn't it depend on what jdbc driver you are using? +> +> Dennis +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster +> +> +> + +From pgsql-performance-owner@postgresql.org Tue Jul 12 22:36:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E101A5281B + for ; + Tue, 12 Jul 2005 22:36:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65765-01 + for ; + Wed, 13 Jul 2005 01:36:28 +0000 (GMT) +Received: from web33911.mail.mud.yahoo.com (web33911.mail.mud.yahoo.com + [66.163.178.75]) + by svr1.postgresql.org (Postfix) with SMTP id 9EE1D52A16 + for ; + Tue, 12 Jul 2005 22:36:26 -0300 (ADT) +Received: (qmail 18627 invoked by uid 60001); 13 Jul 2005 01:36:30 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=dlYn9uGbeNqkmptWPFwWrLks7RsgJNmSD1q5hMJaAa9dAPjqDOQUsuN4ftlFEkYMdYBqBHo1Qo5TSjAX5rdC1xkfm7deTdKCFT228Qn12Zt6zkziSUf0MgSpLdU/O07AAr695Evu0+Lo5uGlSehu5GTWoN3i35nQXgG8BM4/M4Y= + ; +Message-ID: <20050713013630.18625.qmail@web33911.mail.mud.yahoo.com> +Received: from [67.106.37.5] by web33911.mail.mud.yahoo.com via HTTP; + Tue, 12 Jul 2005 18:36:30 PDT +Date: Tue, 12 Jul 2005 18:36:30 -0700 (PDT) +From: Brent Henry +Subject: Re: General DB Tuning +To: Christopher Kings-Lynne , + Dennis , Tom Arthurs +Cc: pgsql-performance@postgresql.org +In-Reply-To: <42D46BC4.2010907@familyhealth.com.au> +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, + hits=2.174 tagged_above=0 required=5 tests=FORGED_YAHOO_RCVD +X-Spam-Level: ** +X-Archive-Number: 200507/132 +X-Sequence-Number: 13373 + +We are running Postgres 8.0.2 with the 8.0.2 jdbc +driver. And yes we are using prepared statements. +I've spent hours trying to get the +'log_min_duration_statement' and 'log_duration' +options to work with no luck. I never get any +duration from the statement. I also never see 'begin' +or 'commit' in the log so I can't tell how long my +batch commands are taking to commit to the DB. + +Is there a different kind of 'prepared' statements +that we should be using in the driver to get logging +to work properly? What is the 'new' protocol? + +Tom, what version are you using? Are you using +prepared statements in JDBC? + +-Brent + + +--- Christopher Kings-Lynne + wrote: + +> >> we are using jdbc -- the +> "log_min_duration_statement = 3000 " +> >> statement works fine for me. Looks like there's +> no other work around +> >> for the bug(?). Not sure since I have no +> interest in logging a +> >> million statements a day, I only want to see the +> poorly performing hits. +> > +> > Doesn't it depend on what jdbc driver you are +> using? +> +> It depends if he's using new-protocol prepared +> queries which don't get +> logged properly. Wasn't that fixed for 8.1 or +> something? +> +> Chris +> +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + + + + +____________________________________________________ +Start your day with Yahoo! - make it your home page +http://www.yahoo.com/r/hs + + +From pgsql-performance-owner@postgresql.org Tue Jul 12 22:49:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 14BED52A08 + for ; + Tue, 12 Jul 2005 22:49:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63838-08 + for ; + Wed, 13 Jul 2005 01:48:57 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id D600F529C2 + for ; + Tue, 12 Jul 2005 22:48:56 -0300 (ADT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 0EF3624FE2; + Wed, 13 Jul 2005 09:48:57 +0800 (WST) +Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id E3E0524FE1; + Wed, 13 Jul 2005 09:48:56 +0800 (WST) +Message-ID: <42D473D4.7040500@familyhealth.com.au> +Date: Wed, 13 Jul 2005 09:52:20 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Brent Henry +Cc: Dennis , + Tom Arthurs , pgsql-performance@postgresql.org +Subject: Re: General DB Tuning +References: <20050713013630.18625.qmail@web33911.mail.mud.yahoo.com> +In-Reply-To: <20050713013630.18625.qmail@web33911.mail.mud.yahoo.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/133 +X-Sequence-Number: 13374 + +> Is there a different kind of 'prepared' statements +> that we should be using in the driver to get logging +> to work properly? What is the 'new' protocol? + +The 8.0.2 jdbc driver uses real prepared statements instead of faked +ones. The problem is the new protocol (that the 8.0.2 driver users) has +a bug where protocol-prepared queries don't get logged properly. + +I don't know if it's been fixed... + +Chris + + +From pgsql-performance-owner@postgresql.org Tue Jul 12 22:53:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 292E352A1D + for ; + Tue, 12 Jul 2005 22:53:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69050-03 + for ; + Wed, 13 Jul 2005 01:53:19 +0000 (GMT) +Received: from mail.jobflash.com (oncallweb2.jobflash.com [64.62.211.41]) + by svr1.postgresql.org (Postfix) with ESMTP id 14D9B529D5 + for ; + Tue, 12 Jul 2005 22:53:18 -0300 (ADT) +Received: from [192.168.2.22] (user-38lc18a.dialup.mindspring.com + [209.86.5.10]) + by mail.jobflash.com (Postfix) with ESMTP id 87228420CF; + Tue, 12 Jul 2005 18:53:21 -0700 (PDT) +Message-ID: <42D47407.10301@jobflash.com> +Date: Tue, 12 Jul 2005 18:53:11 -0700 +From: Tom Arthurs +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Brent Henry +Cc: Christopher Kings-Lynne , + Dennis , pgsql-performance@postgresql.org +Subject: Re: General DB Tuning +References: <20050713013630.18625.qmail@web33911.mail.mud.yahoo.com> +In-Reply-To: <20050713013630.18625.qmail@web33911.mail.mud.yahoo.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/134 +X-Sequence-Number: 13375 + +Here's the answer for you from the jdbc list: + +> Alvin Hung wrote: +> +> +>>> Currently, 8.0.2 / JDBC 8.0-310, log_min_duration_statement does not +>>> work with JDBC. Nothing will get logged. This makes it very +>>> difficult to tune a java application. Can you tell me when will this +>>> be fixed? Thanks. +> +> +> This is a server limitation: it does not handle logging of the V3 +> extended query protocol very well. There's gradual progress being made +> on it; you might want to search the pgsql-hackers and pgsql-patches +> archives for details. +========================================================================================== + + +We are using prepared statements, but we are using the 7.4 driver with +the 8.0.3 server. I think it comes down to locally (on the client) +prepared statements vs using server side prepared statments. I never +got past this issue (changing the code is in our todo list, but pretty +far down it) so I never noticed the logging issues.) + +I had a problem with prepared statements with the 8.x drivers -- here's +what I got from the jdbc list when I asked the question: + +>>1. What changed between the driver versions that generate this error? +> +> +> The driver started to use server-side prepared statements for +> parameterization of queries (i.e. the driver translates ? to $n in the +> main query string, and sends the actual parameter values out-of-band +> from the query itself). One sideeffect of this is that parameters are +> more strongly typed than in the 7.4.x versions where the driver would do +> literal parameter substitution into the query string before sending it +> to the backend. Also, you can use parameters in fewer places (they must +> fit the backend's idea of where parameterizable expressions are allowed) +> -- e.g. see the recent thread about "ORDER BY ?" changing behaviour with +> the newer driver. +> +> +>>> 2. What is the downside of continuing to use the 7.x version of the +>>> driver -- or are there better alternatives (patch, new version, etc). I +>>> am using build 311 of the driver. +> +> +> Most active development happens on the 8.0 version; 7.4.x is maintained +> for bugfixes but that's about it, you won't get the benefit of any +> performance improvements or added features that go into 8.0. Also, the +> 7.4.x driver won't necessarily work with servers >= 8.0. +> +> In the longer term, the 7.4.x version will eventually become unmaintained. + +So for the short term, you could downgrade your driver. + + +Brent Henry wrote: +> We are running Postgres 8.0.2 with the 8.0.2 jdbc +> driver. And yes we are using prepared statements. +> I've spent hours trying to get the +> 'log_min_duration_statement' and 'log_duration' +> options to work with no luck. I never get any +> duration from the statement. I also never see 'begin' +> or 'commit' in the log so I can't tell how long my +> batch commands are taking to commit to the DB. +> +> Is there a different kind of 'prepared' statements +> that we should be using in the driver to get logging +> to work properly? What is the 'new' protocol? +> +> Tom, what version are you using? Are you using +> prepared statements in JDBC? +> +> -Brent +> +> +> --- Christopher Kings-Lynne +> wrote: +> +> +>>>>we are using jdbc -- the +>> +>>"log_min_duration_statement = 3000 " +>> +>>>>statement works fine for me. Looks like there's +>> +>>no other work around +>> +>>>>for the bug(?). Not sure since I have no +>> +>>interest in logging a +>> +>>>>million statements a day, I only want to see the +>> +>>poorly performing hits. +>> +>>>Doesn't it depend on what jdbc driver you are +>> +>>using? +>> +>>It depends if he's using new-protocol prepared +>>queries which don't get +>>logged properly. Wasn't that fixed for 8.1 or +>>something? +>> +>>Chris +>> +>> +>>---------------------------(end of +>>broadcast)--------------------------- +>>TIP 3: Have you checked our extensive FAQ? +>> +>> http://www.postgresql.org/docs/faq +>> +> +> +> +> +> +> ____________________________________________________ +> Start your day with Yahoo! - make it your home page +> http://www.yahoo.com/r/hs +> +> +> +> + +From pgsql-performance-owner@postgresql.org Wed Jul 13 02:18:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 53D3E5284E + for ; + Wed, 13 Jul 2005 02:18:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16591-05 + for ; + Wed, 13 Jul 2005 05:18:36 +0000 (GMT) +Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.197]) + by svr1.postgresql.org (Postfix) with ESMTP id B315252BD9 + for ; + Wed, 13 Jul 2005 02:18:34 -0300 (ADT) +Received: by nproxy.gmail.com with SMTP id x37so16816nfc + for ; + Tue, 12 Jul 2005 22:18:32 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=YFtvkHgUV2lPts5Hr4eWNCYh4BXqs8OBf6FB4Ywoh6lZNbTYeFRGjuKJhGdxbAzCXQKCUrjjaYMZvvMJKqhYIhZ3k1TwsOWlZX7t3lltn0PI3fOkkt8q8vUPqSif+8YF1TOutNygPVlUa9Q5sEqrSgwKgpwNXqWPDxRMT4l6UK8= +Received: by 10.48.239.19 with SMTP id m19mr13102nfh; + Tue, 12 Jul 2005 22:18:32 -0700 (PDT) +Received: by 10.48.49.14 with HTTP; Tue, 12 Jul 2005 22:18:32 -0700 (PDT) +Message-ID: <4b09a0c050712221813fa6d64@mail.gmail.com> +Date: Wed, 13 Jul 2005 07:18:32 +0200 +From: Jean-Max Reymond +Reply-To: Jean-Max Reymond +To: pgsql-performance@postgresql.org +Subject: Re: Projecting currentdb to more users +In-Reply-To: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.072 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/135 +X-Sequence-Number: 13376 + +2005/7/12, Mohan, Ross : +> From AMD's suit against Intel. Perhaps relevant to some PG/AMD issues. + +Postgres is compiled with gnu compiler. Isn't it ? +I don't know how much can Postgres benefit from an optimized Intel compiler= +. + +--=20 +Jean-Max Reymond +CKR Solutions Open Source +Nice France +http://www.ckr-solutions.com + +From pgsql-performance-owner@postgresql.org Wed Jul 13 05:21:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3538C52BC1 + for ; + Wed, 13 Jul 2005 05:20:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58554-01 + for ; + Wed, 13 Jul 2005 08:20:54 +0000 (GMT) +Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.203]) + by svr1.postgresql.org (Postfix) with ESMTP id 8D2D652862 + for ; + Wed, 13 Jul 2005 05:20:52 -0300 (ADT) +Received: by nproxy.gmail.com with SMTP id n15so24528nfc + for ; + Wed, 13 Jul 2005 01:20:51 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; + b=rnErMerhImKEqUJ/Pe9i+Nhhyr2f/GIxNOp1FUQVyQsz4052XNArVeK1PZv0HOi+oonaHPgiUVp03WlyFpaIv6SliEUzzSkqPSb9sbst+agUWcAS1fYCU7IHhrGoq8qL6phS5n4izai9gbQbRnHK+ThZ+2banSp4Hhk/koUkNSU= +Received: by 10.48.237.12 with SMTP id k12mr17690nfh; + Wed, 13 Jul 2005 01:20:51 -0700 (PDT) +Received: by 10.48.49.14 with HTTP; Wed, 13 Jul 2005 01:20:51 -0700 (PDT) +Message-ID: <4b09a0c05071301207d452ace@mail.gmail.com> +Date: Wed, 13 Jul 2005 10:20:51 +0200 +From: Jean-Max Reymond +Reply-To: Jean-Max Reymond +To: pgsql-performance@postgresql.org +Subject: size of cache +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.069 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/136 +X-Sequence-Number: 13377 + +with my application, it seems that size of cache has great effect: +from 512 Kb of L2 cache to 1Mb boost performance with a factor 3 and +20% again from 1Mb L2 cache to 2Mb L2 cache. +I don't understand why a 512Kb cache L2 is too small to fit the data's +does it exist a tool to trace processor activity and confirm that +processor is waiting for memory ? +does it exist a tool to snapshot postgres activity and understand +where we spend time and potentialy avoid the bottleneck ? + +thanks for your tips. + +--=20 +Jean-Max Reymond +CKR Solutions Open Source +Nice France +http://www.ckr-solutions.com + +From pgsql-performance-owner@postgresql.org Wed Jul 13 07:07:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D082252ABF + for ; + Wed, 13 Jul 2005 07:07:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81805-06 + for ; + Wed, 13 Jul 2005 10:07:48 +0000 (GMT) +Received: from pythagoras.zen.co.uk (pythagoras.zen.co.uk [212.23.3.140]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DC9252AB4 + for ; + Wed, 13 Jul 2005 07:07:46 -0300 (ADT) +Received: from [62.3.112.246] (helo=gweek.purplebat.com) + by pythagoras.zen.co.uk with esmtp (Exim 4.30) + id 1Dse9V-0005RL-Fr; Wed, 13 Jul 2005 10:07:41 +0000 +Received: from mrae by gweek.purplebat.com with local (Exim 3.36 #1 (Debian)) + id 1Dse9U-0007HG-00; Wed, 13 Jul 2005 11:07:40 +0100 +Date: Wed, 13 Jul 2005 11:07:40 +0100 +To: Christopher Kings-Lynne +Cc: Brent Henry , Dennis , + Tom Arthurs , pgsql-performance@postgresql.org +Subject: Re: General DB Tuning +Message-ID: <20050713100740.GA27912@purplebat.com> +References: <20050713013630.18625.qmail@web33911.mail.mud.yahoo.com> + <42D473D4.7040500@familyhealth.com.au> +Mime-Version: 1.0 +Content-Type: multipart/mixed; boundary="W/nzBZO5zC0uMSeA" +Content-Disposition: inline +In-Reply-To: <42D473D4.7040500@familyhealth.com.au> +User-Agent: Mutt/1.5.9i +From: Mark Rae +X-Originating-Pythagoras-IP: [62.3.112.246] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.033 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/138 +X-Sequence-Number: 13379 + + +--W/nzBZO5zC0uMSeA +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline + +On Wed, Jul 13, 2005 at 09:52:20AM +0800, Christopher Kings-Lynne wrote: +> The 8.0.2 jdbc driver uses real prepared statements instead of faked +> ones. The problem is the new protocol (that the 8.0.2 driver users) has +> a bug where protocol-prepared queries don't get logged properly. +> I don't know if it's been fixed... + +It's not in 8.0.3, but I was having the same problems with DBD::Pg so +I backported some of it and also changed the code so that it listed the +values of the bind parameters, so you get something like + +LOG: statement: SELECT sr.name,sr.seq_region_id, sr.length, 1 FROM seq_region sr WHERE sr.name = $1 AND sr.coord_system_id = $2 +LOG: binding: "dbdpg_2" with 2 parameters +LOG: bind "dbdpg_2" $1 = "20" +LOG: bind "dbdpg_2" $2 = "1" +LOG: statement: EXECUTE [PREPARE: SELECT sr.name,sr.seq_region_id, sr.length, 1 FROM seq_region sr WHERE sr.name = $1 AND sr.coord_system_id = $2] +LOG: duration: 0.164 ms + +I've attached a patch in case anyone finds it useful. + + -Mark + +--W/nzBZO5zC0uMSeA +Content-Type: text/plain; charset=us-ascii +Content-Disposition: attachment; filename="timing.patch" + +*** postgresql-8.0.3/src/backend/tcop/postgres.c 2005-07-13 09:42:04.997669193 +0100 +--- postgresql-8.0.3/src/backend/tcop/postgres.c 2005-07-13 09:34:24.618195580 +0100 +*************** +*** 1370,1375 **** +--- 1370,1378 ---- + else + portal = CreatePortal(portal_name, false, false); + ++ if (log_statement == LOGSTMT_ALL) ++ ereport(LOG, (errmsg("binding: \"%s\" with %d parameters", stmt_name, numParams))); ++ + /* + * Fetch parameters, if any, and store in the portal's memory context. + * +*************** +*** 1428,1433 **** +--- 1431,1439 ---- + * grotty but is a big win when dealing with very + * large parameter strings. + */ ++ if (log_statement == LOGSTMT_ALL) ++ ereport(LOG, (errmsg("bind \"%s\" $%d = \"%s\"", stmt_name, i+1, pvalue))); ++ + pbuf.data = (char *) pvalue; + pbuf.maxlen = plength + 1; + pbuf.len = plength; +*************** +*** 1578,1583 **** +--- 1584,1593 ---- + bool is_trans_exit = false; + bool completed; + char completionTag[COMPLETION_TAG_BUFSIZE]; ++ struct timeval start_t, stop_t; ++ bool save_log_duration = log_duration; ++ int save_log_min_duration_statement = log_min_duration_statement; ++ bool save_log_statement_stats = log_statement_stats; + + /* Adjust destination to tell printtup.c what to do */ + dest = whereToSendOutput; +*************** +*** 1614,1619 **** +--- 1624,1647 ---- + + set_ps_display(portal->commandTag); + ++ /* ++ * We use save_log_* so "SET log_duration = true" and "SET ++ * log_min_duration_statement = true" don't report incorrect time ++ * because gettimeofday() wasn't called. Similarly, ++ * log_statement_stats has to be captured once. ++ */ ++ if (save_log_duration || save_log_min_duration_statement != -1) ++ gettimeofday(&start_t, NULL); ++ ++ if (save_log_statement_stats) ++ ResetUsage(); ++ ++ if (log_statement == LOGSTMT_ALL) ++ /* We have the portal, so output the source query. */ ++ ereport(LOG, ++ (errmsg("statement: EXECUTE %s [PREPARE: %s]", portal_name, ++ portal->sourceText ? portal->sourceText : ""))); ++ + BeginCommand(portal->commandTag, dest); + + /* Check for transaction-control commands */ +*************** +*** 1708,1713 **** +--- 1736,1785 ---- + pq_putemptymessage('s'); + } + ++ /* ++ * Combine processing here as we need to calculate the query duration ++ * in both instances. ++ */ ++ if (save_log_duration || save_log_min_duration_statement != -1) ++ { ++ long usecs; ++ ++ gettimeofday(&stop_t, NULL); ++ if (stop_t.tv_usec < start_t.tv_usec) ++ { ++ stop_t.tv_sec--; ++ stop_t.tv_usec += 1000000; ++ } ++ usecs = (long) (stop_t.tv_sec - start_t.tv_sec) * 1000000 + ++ (long) (stop_t.tv_usec - start_t.tv_usec); ++ ++ /* Only print duration if we previously printed the statement. */ ++ if (log_statement == LOGSTMT_ALL && save_log_duration) ++ ereport(LOG, ++ (errmsg("duration: %ld.%03ld ms", ++ (long) ((stop_t.tv_sec - start_t.tv_sec) * 1000 + ++ (stop_t.tv_usec - start_t.tv_usec) / 1000), ++ (long) (stop_t.tv_usec - start_t.tv_usec) % 1000))); ++ ++ /* ++ * Output a duration_statement to the log if the query has ++ * exceeded the min duration, or if we are to print all durations. ++ */ ++ if (save_log_min_duration_statement == 0 || ++ (save_log_min_duration_statement > 0 && ++ usecs >= save_log_min_duration_statement * 1000)) ++ ereport(LOG, ++ (errmsg("duration: %ld.%03ld ms statement: EXECUTE %s [PREPARE: %s]", ++ (long) ((stop_t.tv_sec - start_t.tv_sec) * 1000 + ++ (stop_t.tv_usec - start_t.tv_usec) / 1000), ++ (long) (stop_t.tv_usec - start_t.tv_usec) % 1000, ++ portal_name, ++ portal->sourceText ? portal->sourceText : ""))); ++ } ++ ++ if (save_log_statement_stats) ++ ShowUsage("QUERY STATISTICS"); ++ + debug_query_string = NULL; + } + + +--W/nzBZO5zC0uMSeA-- + +From pgsql-performance-owner@postgresql.org Wed Jul 13 06:58:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4D99852A22 + for ; + Wed, 13 Jul 2005 06:58:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79477-03 + for ; + Wed, 13 Jul 2005 09:58:01 +0000 (GMT) +Received: from smtp2.univ-nantes.fr (Smtp2.univ-nantes.fr [193.52.82.19]) + by svr1.postgresql.org (Postfix) with ESMTP id 32ADE529A9 + for ; + Wed, 13 Jul 2005 06:57:59 -0300 (ADT) +Received: from localhost (debian [127.0.0.1]) + by smtp2.univ-nantes.fr (Postfix) with ESMTP id B9B23381021 + for ; + Wed, 13 Jul 2005 11:58:00 +0200 (CEST) +Received: from smtp2.univ-nantes.fr ([172.20.12.56]) + by localhost (smtp2.univ-nantes.prive [172.20.12.56]) (amavisd-new, + port 10024) + with LMTP id 00670-01-47 for ; + Wed, 13 Jul 2005 11:58:00 +0200 (CEST) +Received: from [172.19.33.37] (unknown [172.19.33.37]) + by smtp2.univ-nantes.fr (Postfix) with ESMTP id A69C4380E78 + for ; + Wed, 13 Jul 2005 11:58:00 +0200 (CEST) +Message-ID: <42D4E836.9020607@univ-nantes.fr> +Date: Wed, 13 Jul 2005 12:08:54 +0200 +From: Nicolas Beaume +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: fr, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: large table vs multiple smal tables +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at smtp.univ-nantes.fr +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/137 +X-Sequence-Number: 13378 + +Hello + +I have a large database with 4 large tables (each containing at least +200 000 rows, perhaps even 1 or 2 million) and i ask myself if it's +better to split them into small tables (e.g tables of 2000 rows) to +speed the access and the update of those tables (considering that i will +have few update but a lot of reading). + +Do you think it would be efficient ? + +Nicolas, wondering if he hadn't be too greedy + +-- + +------------------------------------------------------------------------- +� soyez ce que vous voudriez avoir l'air d'�tre � Lewis Caroll + + +From pgsql-performance-owner@postgresql.org Fri Jul 15 02:05:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A5C5E5294F + for ; + Wed, 13 Jul 2005 09:50:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18660-10 + for ; + Wed, 13 Jul 2005 12:50:44 +0000 (GMT) +Received: from is.rice.edu (is.rice.edu [128.42.42.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 3D4D552856 + for ; + Wed, 13 Jul 2005 09:50:43 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by is.rice.edu (Postfix) with ESMTP id 205B741EDB; + Wed, 13 Jul 2005 07:50:47 -0500 (CDT) +Received: from is.rice.edu ([127.0.0.1]) + by localhost (it.is.rice.edu [127.0.0.1]) (amavisd-new, + port 10024) with LMTP + id 27809-01-81; Wed, 13 Jul 2005 07:50:39 -0500 (CDT) +Received: by is.rice.edu (Postfix, from userid 18612) + id BBB4B41EEB; Wed, 13 Jul 2005 07:33:05 -0500 (CDT) +Date: Wed, 13 Jul 2005 07:33:05 -0500 +From: Kenneth Marshall +To: Nicolas Beaume +Cc: pgsql-performance@postgresql.org +Subject: Re: large table vs multiple smal tables +Message-ID: <20050713123305.GB17225@it.is.rice.edu> +References: <42D4E836.9020607@univ-nantes.fr> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42D4E836.9020607@univ-nantes.fr> +User-Agent: Mutt/1.4.2i +X-Virus-Scanned: by amavis-2.2.1 at is.rice.edu +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/206 +X-Sequence-Number: 13447 + +Nicolas, + +These sizes would not be considered large. I would leave them +as single tables. + +Ken + +On Wed, Jul 13, 2005 at 12:08:54PM +0200, Nicolas Beaume wrote: +> Hello +> +> I have a large database with 4 large tables (each containing at least +> 200 000 rows, perhaps even 1 or 2 million) and i ask myself if it's +> better to split them into small tables (e.g tables of 2000 rows) to +> speed the access and the update of those tables (considering that i will +> have few update but a lot of reading). +> +> Do you think it would be efficient ? +> +> Nicolas, wondering if he hadn't be too greedy +> +> -- +> +> ------------------------------------------------------------------------- +> ? soyez ce que vous voudriez avoir l'air d'?tre ? Lewis Caroll +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster + +From pgsql-performance-owner@postgresql.org Wed Jul 13 10:45:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CCC3A52A2C + for ; + Wed, 13 Jul 2005 10:45:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 33713-06 + for ; + Wed, 13 Jul 2005 13:44:58 +0000 (GMT) +Received: from smtp2.univ-nantes.fr (Smtp2.univ-nantes.fr [193.52.82.19]) + by svr1.postgresql.org (Postfix) with ESMTP id C7DB85298C + for ; + Wed, 13 Jul 2005 10:44:57 -0300 (ADT) +Received: from localhost (debian [127.0.0.1]) + by smtp2.univ-nantes.fr (Postfix) with ESMTP id C3D0C380F32 + for ; + Wed, 13 Jul 2005 15:44:58 +0200 (CEST) +Received: from smtp2.univ-nantes.fr ([172.20.12.56]) + by localhost (smtp2.univ-nantes.prive [172.20.12.56]) (amavisd-new, + port 10024) + with LMTP id 16863-01-97 for ; + Wed, 13 Jul 2005 15:44:58 +0200 (CEST) +Received: from [172.19.33.37] (unknown [172.19.33.37]) + by smtp2.univ-nantes.fr (Postfix) with ESMTP id B362A380E85 + for ; + Wed, 13 Jul 2005 15:44:58 +0200 (CEST) +Message-ID: <42D51D68.8000405@univ-nantes.fr> +Date: Wed, 13 Jul 2005 15:55:52 +0200 +From: Nicolas Beaume +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: fr, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: (pas de sujet) +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at smtp.univ-nantes.fr +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/139 +X-Sequence-Number: 13380 + +>Nicolas, +> +>These sizes would not be considered large. I would leave them +>as single tables. +> +>Ken + + + +ok, i though it was large but i must confess i'm relatively new in the +database word. thank you for the answer. + +Just another question : what is the maximal number of rows that can be +contain in a cursor ? + +Nicolas, having a lot of things to learn + +-- + +------------------------------------------------------------------------- +� soyez ce que vous voudriez avoir l'air d'�tre � Lewis Caroll + + +From pgsql-performance-owner@postgresql.org Wed Jul 13 12:56:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 953F152B80 + for ; + Wed, 13 Jul 2005 12:56:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 78975-03 + for ; + Wed, 13 Jul 2005 15:56:01 +0000 (GMT) +Received: from cmailg3.svr.pol.co.uk (cmailg3.svr.pol.co.uk [195.92.195.173]) + by svr1.postgresql.org (Postfix) with ESMTP id 1055052B16 + for ; + Wed, 13 Jul 2005 12:56:00 -0300 (ADT) +Received: from modem-2867.leopard.dialup.pol.co.uk ([217.135.155.51] + helo=192.168.0.102) by cmailg3.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DsjaX-000574-9Z; Wed, 13 Jul 2005 16:55:57 +0100 +Subject: Re: cost-based vacuum +From: Simon Riggs +To: Ian Westmacott , + Tom Lane +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1121190651.10346.342.camel@spectre.intellivid.com> +References: <1120839902.20657.197.camel@spectre.intellivid.com> + <1121081504.3970.53.camel@localhost.localdomain> + <1121087266.27427.35.camel@spectre.intellivid.com> + <1121093488.3970.70.camel@localhost.localdomain> + <1121154338.3970.106.camel@localhost.localdomain> + <1121190651.10346.342.camel@spectre.intellivid.com> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Wed, 13 Jul 2005 16:55:50 +0100 +Message-Id: <1121270150.3970.256.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/140 +X-Sequence-Number: 13381 + +On Tue, 2005-07-12 at 13:50 -0400, Ian Westmacott wrote: +> It appears not to matter whether it is one of the tables +> being written to that is ANALYZEd. I can ANALYZE an old, +> quiescent table, or a system table and see this effect. + +Can you confirm that this effect is still seen even when the ANALYZE +doesn't touch *any* of the tables being accessed? + +> - this is a dual Xeon. + +Is that Xeon MP then? + +> - Looking at oprofile reports for 10-minute runs of a +> database-wide VACUUM with vacuum_cost_delay=0 and 1000, +> shows the latter spending a lot of time in LWLockAcquire +> and LWLockRelease (20% each vs. 2%). + +Is this associated with high context switching also? + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Wed Jul 13 13:08:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 35A1352ABE + for ; + Wed, 13 Jul 2005 13:08:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83738-01 + for ; + Wed, 13 Jul 2005 16:07:56 +0000 (GMT) +Received: from cmailm2.svr.pol.co.uk (cmailm2.svr.pol.co.uk [195.92.193.210]) + by svr1.postgresql.org (Postfix) with ESMTP id 5ED1952A58 + for ; + Wed, 13 Jul 2005 13:07:54 -0300 (ADT) +Received: from modem-2867.leopard.dialup.pol.co.uk ([217.135.155.51] + helo=192.168.0.102) by cmailm2.svr.pol.co.uk with esmtp (Exim 4.41) + id 1Dsjm6-0001VV-32; Wed, 13 Jul 2005 17:07:54 +0100 +Subject: Re: size of cache +From: Simon Riggs +To: Jean-Max Reymond +Cc: pgsql-performance@postgresql.org +In-Reply-To: <4b09a0c05071301207d452ace@mail.gmail.com> +References: <4b09a0c05071301207d452ace@mail.gmail.com> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Wed, 13 Jul 2005 17:07:47 +0100 +Message-Id: <1121270867.3970.266.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/141 +X-Sequence-Number: 13382 + +On Wed, 2005-07-13 at 10:20 +0200, Jean-Max Reymond wrote: +> with my application, it seems that size of cache has great effect: +> from 512 Kb of L2 cache to 1Mb boost performance with a factor 3 and +> 20% again from 1Mb L2 cache to 2Mb L2 cache. + +Memory request time is the main bottleneck in well tuned database +systems, so your results could be reasonable. + +> I don't understand why a 512Kb cache L2 is too small to fit the data's +> does it exist a tool to trace processor activity and confirm that +> processor is waiting for memory ? + +You have both data and instruction cache on the CPU. It is likely it is +the instruction cache that is too small to fit all of the code required +for your application's workload mix. + +Use Intel VTune or similar to show the results you seek. + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Wed Jul 13 13:11:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 01BDD52A08 + for ; + Wed, 13 Jul 2005 13:10:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83642-03 + for ; + Wed, 13 Jul 2005 16:10:21 +0000 (GMT) +Received: from cmailg1.svr.pol.co.uk (cmailg1.svr.pol.co.uk [195.92.195.171]) + by svr1.postgresql.org (Postfix) with ESMTP id 8F7D452BCF + for ; + Wed, 13 Jul 2005 13:10:18 -0300 (ADT) +Received: from modem-2867.leopard.dialup.pol.co.uk ([217.135.155.51] + helo=192.168.0.102) by cmailg1.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DsjoL-0007Kq-2r; Wed, 13 Jul 2005 17:10:13 +0100 +Subject: Re: General DB Tuning +From: Simon Riggs +To: Christopher Kings-Lynne +Cc: Brent Henry , Dennis , + Tom Arthurs , pgsql-performance@postgresql.org +In-Reply-To: <42D473D4.7040500@familyhealth.com.au> +References: <20050713013630.18625.qmail@web33911.mail.mud.yahoo.com> + <42D473D4.7040500@familyhealth.com.au> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Wed, 13 Jul 2005 17:10:06 +0100 +Message-Id: <1121271006.3970.268.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/142 +X-Sequence-Number: 13383 + +On Wed, 2005-07-13 at 09:52 +0800, Christopher Kings-Lynne wrote: +> > Is there a different kind of 'prepared' statements +> > that we should be using in the driver to get logging +> > to work properly? What is the 'new' protocol? +> +> The 8.0.2 jdbc driver uses real prepared statements instead of faked +> ones. The problem is the new protocol (that the 8.0.2 driver users) has +> a bug where protocol-prepared queries don't get logged properly. +> +> I don't know if it's been fixed... + +Yes, there is a fix for this in 8.1 + +Brent has been sent the details. + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Wed Jul 13 15:40:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9CAE752B9E + for ; + Wed, 13 Jul 2005 15:40:41 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31268-08 + for ; + Wed, 13 Jul 2005 18:40:37 +0000 (GMT) +Received: from mailhost.intellivid.com (mailhost.intellivid.com + [64.32.200.11]) + by svr1.postgresql.org (Postfix) with ESMTP id 36DCE52B4E + for ; + Wed, 13 Jul 2005 15:40:36 -0300 (ADT) +Received: from [192.168.2.68] (spectre.intellivid.com [192.168.2.68]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (Client did not present a certificate) + by newmail.intellivid.com (Postfix) with ESMTP id 8595FF1829F; + Wed, 13 Jul 2005 14:40:36 -0400 (EDT) +Subject: Re: cost-based vacuum +From: Ian Westmacott +To: Simon Riggs +Cc: Tom Lane , pgsql-performance@postgresql.org +In-Reply-To: <1121270150.3970.256.camel@localhost.localdomain> +References: <1120839902.20657.197.camel@spectre.intellivid.com> + <1121081504.3970.53.camel@localhost.localdomain> + <1121087266.27427.35.camel@spectre.intellivid.com> + <1121093488.3970.70.camel@localhost.localdomain> + <1121154338.3970.106.camel@localhost.localdomain> + <1121190651.10346.342.camel@spectre.intellivid.com> + <1121270150.3970.256.camel@localhost.localdomain> +Content-Type: text/plain +Organization: Intellivid Corp. +Message-Id: <1121280036.13208.8.camel@spectre.intellivid.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 +Date: Wed, 13 Jul 2005 14:40:36 -0400 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/143 +X-Sequence-Number: 13384 + +On Wed, 2005-07-13 at 11:55, Simon Riggs wrote: +> On Tue, 2005-07-12 at 13:50 -0400, Ian Westmacott wrote: +> > It appears not to matter whether it is one of the tables +> > being written to that is ANALYZEd. I can ANALYZE an old, +> > quiescent table, or a system table and see this effect. +> +> Can you confirm that this effect is still seen even when the ANALYZE +> doesn't touch *any* of the tables being accessed? + +Yes. + +> > - this is a dual Xeon. +> +> Is that Xeon MP then? + +Yes. + +> > - Looking at oprofile reports for 10-minute runs of a +> > database-wide VACUUM with vacuum_cost_delay=0 and 1000, +> > shows the latter spending a lot of time in LWLockAcquire +> > and LWLockRelease (20% each vs. 2%). +> +> Is this associated with high context switching also? + +Yes, it appears that context switches increase up to 4-5x +during cost-based ANALYZE. + + --Ian + + + +From pgsql-performance-owner@postgresql.org Wed Jul 13 15:54:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2F3AD52A1A + for ; + Wed, 13 Jul 2005 15:54:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36640-02 + for ; + Wed, 13 Jul 2005 18:54:40 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id BF44E529CF + for ; + Wed, 13 Jul 2005 15:54:38 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id B09F46441D3 + for ; + Wed, 13 Jul 2005 12:54:15 -0600 (MDT) +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 28395-03 for ; + Wed, 13 Jul 2005 12:54:13 -0600 (MDT) +Received: from [192.168.1.100] (c-67-162-134-190.hsd1.co.comcast.net + [67.162.134.190]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id BA38A6441CB + for ; + Wed, 13 Jul 2005 12:54:13 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +Content-Transfer-Encoding: 7bit +Message-Id: +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +To: pgsql-performance@postgresql.org +From: Dan Harris +Subject: Quad Opteron stuck in the mud +Date: Wed, 13 Jul 2005 12:54:35 -0600 +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/144 +X-Sequence-Number: 13385 + +Gurus, + +A table in one of my databases has just crossed the 30 million row +mark and has begun to feel very sluggish for just about anything I do +with it. I keep the entire database vacuumed regularly. And, as +long as I'm not doing a sequential scan, things seem reasonably quick +most of the time. I'm now thinking that my problem is IO because +anything that involves heavy ( like a seq scan ) IO seems to slow to +a crawl. Even if I am using indexed fields to grab a few thousand +rows, then going to sequential scans it gets very very slow. + +I have also had the occurrence where queries will not finish for days +( I eventually have to kill them ). I was hoping to provide an +explain analyze for them, but if they never finish... even the +explain never finishes when I try that. + +For example, as I'm writing this, I am running an UPDATE statement +that will affect a small part of the table, and is querying on an +indexed boolean field. + +I have been waiting for over an hour and a half as I write this and +it still hasn't finished. I'm thinking "I bet Tom, Simon or Josh +wouldn't put up with this kind of wait time..", so I thought I would +see if anyone here had some pointers. Maybe I have a really stupid +setting in my conf file that is causing this. I really can't believe +I am at the limits of this hardware, however. + + +The query: +update eventactivity set ftindex = false where ftindex = true; +( added the where clause because I don't want to alter where ftindex +is null ) + + + +The table: + Column | Type | Modifiers +-------------+-----------------------------+----------- +entrydate | timestamp without time zone | +incidentid | character varying(40) | +statustype | character varying(20) | +unitid | character varying(20) | +recordtext | character varying(255) | +recordtext2 | character varying(255) | +insertdate | timestamp without time zone | +ftindex | boolean | +Indexes: eventactivity1 btree (incidentid), + eventactivity_entrydate_idx btree (entrydate), + eventactivity_ftindex_idx btree (ftindex), + eventactivity_oid_idx btree (oid) + + + + +The hardware: + +4 x 2.2GHz Opterons +12 GB of RAM +4x10k 73GB Ultra320 SCSI drives in RAID 0+1 +1GB hardware cache memory on the RAID controller + +The OS: +Fedora, kernel 2.6.6-1.435.2.3smp ( redhat stock kernel ) +filesystem is mounted as ext2 + +##### + +vmstat output ( as I am waiting for this to finish ): +procs -----------memory---------- ---swap-- -----io---- --system-- +----cpu---- +r b swpd free buff cache si so bi bo in cs us +sy id wa +0 1 5436 2823908 26140 9183704 0 1 2211 540 694 336 +9 2 76 13 + +##### + +iostat output ( as I am waiting for this to finish ): +avg-cpu: %user %nice %sys %iowait %idle + 9.19 0.00 2.19 13.08 75.53 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +cciss/c0d0 329.26 17686.03 4317.57 161788630 39496378 + + +##### +This is a dedicated postgresql server, so maybe some of these +settings are more liberal than they should be? + +relevant ( I hope ) postgresql.conf options are: + +shared_buffers = 50000 +effective_cache_size = 1348000 +random_page_cost = 3 +work_mem = 512000 +max_fsm_pages = 80000 +log_min_duration_statement = 60000 +fsync = true ( not sure if I'm daring enough to run without this ) +wal_buffers = 1000 +checkpoint_segments = 64 +checkpoint_timeout = 3000 + + +#---- FOR PG_AUTOVACUUM --# +stats_command_string = true +stats_row_level = true + +Thanks in advance, +Dan + + + + + + + + +From pgsql-performance-owner@postgresql.org Wed Jul 13 15:59:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A71CD52BC7 + for ; + Wed, 13 Jul 2005 15:58:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36499-05 + for ; + Wed, 13 Jul 2005 18:58:57 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E212E52B8E + for ; + Wed, 13 Jul 2005 15:58:56 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6DIwqHE020660; + Wed, 13 Jul 2005 14:58:52 -0400 (EDT) +To: Ian Westmacott +Cc: Simon Riggs , + pgsql-performance@postgresql.org +Subject: Re: cost-based vacuum +In-reply-to: <1121280036.13208.8.camel@spectre.intellivid.com> +References: <1120839902.20657.197.camel@spectre.intellivid.com> + <1121081504.3970.53.camel@localhost.localdomain> + <1121087266.27427.35.camel@spectre.intellivid.com> + <1121093488.3970.70.camel@localhost.localdomain> + <1121154338.3970.106.camel@localhost.localdomain> + <1121190651.10346.342.camel@spectre.intellivid.com> + <1121270150.3970.256.camel@localhost.localdomain> + <1121280036.13208.8.camel@spectre.intellivid.com> +Comments: In-reply-to Ian Westmacott + message dated "Wed, 13 Jul 2005 14:40:36 -0400" +Date: Wed, 13 Jul 2005 14:58:52 -0400 +Message-ID: <20659.1121281132@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/145 +X-Sequence-Number: 13386 + +Ian Westmacott writes: +> On Wed, 2005-07-13 at 11:55, Simon Riggs wrote: +>> On Tue, 2005-07-12 at 13:50 -0400, Ian Westmacott wrote: +>>> It appears not to matter whether it is one of the tables +>>> being written to that is ANALYZEd. I can ANALYZE an old, +>>> quiescent table, or a system table and see this effect. +>> +>> Can you confirm that this effect is still seen even when the ANALYZE +>> doesn't touch *any* of the tables being accessed? + +> Yes. + +This really isn't making any sense at all. I took another look through +the vacuum_delay_point() calls, and I can see a couple that are +questionably placed: + +* the one in count_nondeletable_pages() is done while we are holding +exclusive lock on the table; we might be better off not to delay there, +so as not to block non-VACUUM processes longer than we have to. + +* the ones in hashbulkdelete and rtbulkdelete are done while holding +various forms of exclusive locks on the index (this was formerly true +of gistbulkdelete as well). Again it might be better not to delay. + +However, these certainly do not explain Ian's problem, because (a) these +only apply to VACUUM, not ANALYZE; (b) they would only lock the table +being VACUUMed, not other ones; (c) if these locks were to block the +reader or writer thread, it'd manifest as blocking on a semaphore, not +as a surge in LWLock thrashing. + +>> Is that Xeon MP then? + +> Yes. + +The LWLock activity is certainly suggestive of prior reports of +excessive buffer manager lock contention, but it makes *no* sense that +that would be higher with vacuum cost delay than without. I'd have +expected the other way around. + +I'd really like to see a test case for this... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jul 13 16:09:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7E9ED52A1A + for ; + Wed, 13 Jul 2005 16:09:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40131-02 + for ; + Wed, 13 Jul 2005 19:09:40 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id C0778529CF + for ; + Wed, 13 Jul 2005 16:09:39 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id B833C6441FC + for ; + Wed, 13 Jul 2005 13:09:17 -0600 (MDT) +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 28395-10 for ; + Wed, 13 Jul 2005 13:09:15 -0600 (MDT) +Received: from [192.168.1.100] (c-67-162-134-190.hsd1.co.comcast.net + [67.162.134.190]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id C0D4D6441DD + for ; + Wed, 13 Jul 2005 13:09:15 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +In-Reply-To: +References: +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <67AA7707-6473-4AF2-89EF-2C90A6AAA2AB@drivefaster.net> +Content-Transfer-Encoding: 7bit +From: Dan Harris +Subject: Re: Quad Opteron stuck in the mud +Date: Wed, 13 Jul 2005 13:09:37 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/146 +X-Sequence-Number: 13387 + +So sorry, I forgot to mention I'm running version 8.0.1 + +Thanks + + +From pgsql-performance-owner@postgresql.org Wed Jul 13 16:11:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CC72E52B9C + for ; + Wed, 13 Jul 2005 16:11:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36077-06 + for ; + Wed, 13 Jul 2005 19:11:46 +0000 (GMT) +Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) + by svr1.postgresql.org (Postfix) with ESMTP id 6A91F52A2C + for ; + Wed, 13 Jul 2005 16:11:45 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP + id <20050713191145m9100cf4v0e>; Wed, 13 Jul 2005 19:11:46 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id ADF9055FEC; Wed, 13 Jul 2005 14:11:45 -0500 (CDT) +Received: from [192.168.1.11] (liliana.arbash-meinel.com [192.168.1.11]) + by juju.arbash-meinel.com (Postfix) with ESMTP id CA49655F98; + Wed, 13 Jul 2005 14:11:41 -0500 (CDT) +Message-ID: <42D56772.6020408@arbash-meinel.com> +Date: Wed, 13 Jul 2005 14:11:46 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: Quad Opteron stuck in the mud +References: +In-Reply-To: +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigD190497174A8400B62E3C137" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.047 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/147 +X-Sequence-Number: 13388 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigD190497174A8400B62E3C137 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Dan Harris wrote: +> Gurus, +> + + > even the explain never +> finishes when I try that. + +Just a short bit. If "EXPLAIN SELECT" doesn't return, there seems to be +a very serious problem. Because I think EXPLAIN doesn't actually run the +query, just has the query planner run. And the query planner shouldn't +ever get heavily stuck. + +I might be wrong, but there may be something much more substantially +wrong than slow i/o. +John +=:-> + +--------------enigD190497174A8400B62E3C137 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC1WdyJdeBCYSNAAMRAo7GAJ4oLZc+JTpiwDJDJ5nzwYRbEAoocwCcDE+o +V8XImXDydGv7uXMX+Fhc31I= +=1gn4 +-----END PGP SIGNATURE----- + +--------------enigD190497174A8400B62E3C137-- + +From pgsql-performance-owner@postgresql.org Wed Jul 13 16:15:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E849852A1A + for ; + Wed, 13 Jul 2005 16:13:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40438-02 + for ; + Wed, 13 Jul 2005 19:13:31 +0000 (GMT) +Received: from lakermmtao06.cox.net (lakermmtao06.cox.net [68.230.240.33]) + by svr1.postgresql.org (Postfix) with ESMTP id 2E2F052C79 + for ; + Wed, 13 Jul 2005 16:13:30 -0300 (ADT) +Received: from [127.0.0.1] (really [68.3.22.74]) by lakermmtao06.cox.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050713191328.NCB2772.lakermmtao06.cox.net@[127.0.0.1]> + for ; + Wed, 13 Jul 2005 15:13:28 -0400 +Message-ID: <42D567DB.6000100@works4me.com> +Date: Wed, 13 Jul 2005 12:13:31 -0700 +From: Dennis +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: performance problems ... 100 cpu utilization +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Antivirus: avast! (VPS 0528-3, 07/13/2005), Outbound message +X-Antivirus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/148 +X-Sequence-Number: 13389 + +Hi, + +I've got a java based web application that uses PostgreSQL 8.0.2. +PostgreSQL runs on its own machine with RHEL 3, ia32e kernel, dual Xeon +processor, 4 Gb ram. + +The web application runs on a seperate machine from the database. The +application machine has three tomcat instances configured to use 64 +database connections each using DBCP for pooling. Most of the data +access is via Hibernate. The database itself is about 100 meg in size. + +We're perf testing the application with Loadrunner. At about 500 virtual +users hitting the web application, the cpu utilization on the database +server is at 100%, PostgreSQL is on its knees. The memory usage isn't +bad, the I/O isn't bad, only the CPU seems to be maxed out. + +checking the status of connections at this point ( ps -eaf | grep +"postgres:") where the CPU is maxed out I saw this: + +127 idle +12 bind +38 parse +34 select + +Hibernate is used in the application and unfortunately this seems to +cause queries not to get logged. (see +http://archives.postgresql.org/pgsql-admin/2005-05/msg00241.php) + +I know there has been discussion about problems on Xeon MP systems. Is +this what we are running into? Or is something else going on? Is there +other information I can provide that might help determine what is going on? + +Here are the postgresql.conf settings: + +# The maximum number of connections. +max_connections = 256 + +# Standard performance-related settings. +shared_buffers = 16384 +max_fsm_pages = 200000 +max_fsm_relations = 10000 +fsync = false +wal_sync_method = fsync +wal_buffers = 32 +checkpoint_segments = 6 +effective_cache_size = 38400 +random_page_cost = 2 +work_mem = 16384 +maintenance_work_mem = 16384 + +# TODO - need to investigate these. +commit_delay = 0 +commit_siblings = 5 +max_locks_per_transaction = 512 + + +From pgsql-performance-owner@postgresql.org Wed Jul 13 16:16:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 67F2752BD6 + for ; + Wed, 13 Jul 2005 16:16:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40357-04 + for ; + Wed, 13 Jul 2005 19:16:28 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 14C4052B9C + for ; + Wed, 13 Jul 2005 16:16:28 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id 572CD644146 + for ; + Wed, 13 Jul 2005 13:16:06 -0600 (MDT) +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 28615-04 for ; + Wed, 13 Jul 2005 13:16:03 -0600 (MDT) +Received: from [192.168.1.100] (c-67-162-134-190.hsd1.co.comcast.net + [67.162.134.190]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id 187BF64411B + for ; + Wed, 13 Jul 2005 13:16:03 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +In-Reply-To: <42D56772.6020408@arbash-meinel.com> +References: + <42D56772.6020408@arbash-meinel.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <862C6AD9-646B-4907-AB18-09F1AD08B5F5@drivefaster.net> +Content-Transfer-Encoding: 7bit +From: Dan Harris +Subject: Re: Quad Opteron stuck in the mud +Date: Wed, 13 Jul 2005 13:16:25 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/149 +X-Sequence-Number: 13390 + + +On Jul 13, 2005, at 1:11 PM, John A Meinel wrote: + +> +> I might be wrong, but there may be something much more substantially +> wrong than slow i/o. +> John +> + +Yes, I'm afraid of that too. I just don't know what tools I should +use to figure that out. I have some 20 other databases on this +system, same schema but varying sizes, and the small ones perform +very well. It feels like there is an O(n) increase in wait time that +has recently become very noticeable on the largest of them. + +-Dan + +From pgsql-performance-owner@postgresql.org Wed Jul 13 17:17:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5860952BDF + for ; + Wed, 13 Jul 2005 17:17:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54397-05 + for ; + Wed, 13 Jul 2005 20:17:04 +0000 (GMT) +Received: from ns.snowman.net (ns.snowman.net [66.92.160.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 8AE8452BE5 + for ; + Wed, 13 Jul 2005 17:17:03 -0300 (ADT) +Received: by ns.snowman.net (Postfix, from userid 1000) + id 36C0F17AF4; Wed, 13 Jul 2005 16:17:15 -0400 (EDT) +Date: Wed, 13 Jul 2005 16:17:15 -0400 +From: Stephen Frost +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: Quad Opteron stuck in the mud +Message-ID: <20050713201715.GI24207@ns.snowman.net> +Mail-Followup-To: Dan Harris , + pgsql-performance@postgresql.org +References: + <42D56772.6020408@arbash-meinel.com> + <862C6AD9-646B-4907-AB18-09F1AD08B5F5@drivefaster.net> +Mime-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="+fvCYAx0wXfEGTTZ" +Content-Disposition: inline +In-Reply-To: <862C6AD9-646B-4907-AB18-09F1AD08B5F5@drivefaster.net> +X-Editor: Vim http://www.vim.org/ +X-Info: http://www.snowman.net +X-Operating-System: Linux/2.4.24ns.3.0 (i686) +X-Uptime: 16:16:30 up 32 days, 12:36, 8 users, load average: 0.12, 0.08, 0.07 +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/150 +X-Sequence-Number: 13391 + + +--+fvCYAx0wXfEGTTZ +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +* Dan Harris (fbsd@drivefaster.net) wrote: +> On Jul 13, 2005, at 1:11 PM, John A Meinel wrote: +> >I might be wrong, but there may be something much more substantially +> >wrong than slow i/o. +>=20 +> Yes, I'm afraid of that too. I just don't know what tools I should =20 +> use to figure that out. I have some 20 other databases on this =20 +> system, same schema but varying sizes, and the small ones perform =20 +> very well. It feels like there is an O(n) increase in wait time that =20 +> has recently become very noticeable on the largest of them. + +Could you come up w/ a test case that others could reproduce where +explain isn't returning? I think that would be very useful towards +solving at least that issue... + + Thanks, + + Stephen + +--+fvCYAx0wXfEGTTZ +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) + +iD8DBQFC1XbKrzgMPqB3kigRAtjJAJ4lRzAyya3SuMnzv6yczJPFvlqdjwCcDLMK +ruMkTUhhdJNCw0hWvi6PGLE= +=/e4k +-----END PGP SIGNATURE----- + +--+fvCYAx0wXfEGTTZ-- + +From pgsql-performance-owner@postgresql.org Wed Jul 13 17:18:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7243552BD4 + for ; + Wed, 13 Jul 2005 17:18:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54607-01 + for ; + Wed, 13 Jul 2005 20:18:18 +0000 (GMT) +Received: from mr2.surnet.cl (smtp2.surnet.cl [216.155.73.163]) + by svr1.postgresql.org (Postfix) with ESMTP id 545F952B5B + for ; + Wed, 13 Jul 2005 17:18:16 -0300 (ADT) +Received: from smtp2.surnet.cl (216.155.73.169) by mr2.surnet.cl (7.0.031.3) + id 4259ADFA015441EB; Wed, 13 Jul 2005 16:17:57 -0400 +Received: from smtp2.surnet.cl (mr2.surnet.cl []) + by mr2.surnet.cl ([216.155.73.169]); Wed, 13 Jul 2005 20:17:57 +0000 +Received: from cluster.surnet.cl (216.155.73.164) by smtp2.surnet.cl + (7.0.031.3) id 4259ADE300CFADA6; Wed, 13 Jul 2005 16:17:57 -0400 +Received: from alvh.no-ip.org (200.85.218.66) by cluster.surnet.cl (7.0.043) + (authenticated as alvherre@surnet.cl) + id 42B3EF6000399CCB; Wed, 13 Jul 2005 16:18:13 -0400 +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id 925F2C370EE; Wed, 13 Jul 2005 16:18:17 -0400 (CLT) +Date: Wed, 13 Jul 2005 16:18:17 -0400 +From: Alvaro Herrera +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: Quad Opteron stuck in the mud +Message-ID: <20050713201817.GA5450@alvh.no-ip.org> +References: + <42D56772.6020408@arbash-meinel.com> + <862C6AD9-646B-4907-AB18-09F1AD08B5F5@drivefaster.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <862C6AD9-646B-4907-AB18-09F1AD08B5F5@drivefaster.net> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.378 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, RCVD_IN_NJABL_PROXY +X-Spam-Level: * +X-Archive-Number: 200507/151 +X-Sequence-Number: 13392 + +On Wed, Jul 13, 2005 at 01:16:25PM -0600, Dan Harris wrote: + +> On Jul 13, 2005, at 1:11 PM, John A Meinel wrote: +> +> >I might be wrong, but there may be something much more substantially +> >wrong than slow i/o. +> +> Yes, I'm afraid of that too. I just don't know what tools I should +> use to figure that out. I have some 20 other databases on this +> system, same schema but varying sizes, and the small ones perform +> very well. It feels like there is an O(n) increase in wait time that +> has recently become very noticeable on the largest of them. + +I'd guess it's stuck on some lock. Try that EXPLAIN, and when it +blocks, watch the pg_locks view for locks not granted to the process +executing the EXPLAIN. Then check what else is holding the locks. + +-- +Alvaro Herrera () +"La rebeld�a es la virtud original del hombre" (Arthur Schopenhauer) + +From pgsql-performance-owner@postgresql.org Wed Jul 13 17:20:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 05EB752A78 + for ; + Wed, 13 Jul 2005 17:20:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55524-01 + for ; + Wed, 13 Jul 2005 20:20:26 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 1D28552C9C + for ; + Wed, 13 Jul 2005 17:20:25 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id 21AB36441AA + for ; + Wed, 13 Jul 2005 14:20:04 -0600 (MDT) +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 29029-10 for ; + Wed, 13 Jul 2005 14:20:02 -0600 (MDT) +Received: from [192.168.1.100] (c-67-162-134-190.hsd1.co.comcast.net + [67.162.134.190]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id 22206644195 + for ; + Wed, 13 Jul 2005 14:20:02 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +In-Reply-To: <20050713201715.GI24207@ns.snowman.net> +References: + <42D56772.6020408@arbash-meinel.com> + <862C6AD9-646B-4907-AB18-09F1AD08B5F5@drivefaster.net> + <20050713201715.GI24207@ns.snowman.net> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <7C8917ED-62B8-4D76-AC02-90CF04002C97@drivefaster.net> +Content-Transfer-Encoding: 7bit +From: Dan Harris +Subject: Re: Quad Opteron stuck in the mud +Date: Wed, 13 Jul 2005 14:20:24 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/152 +X-Sequence-Number: 13393 + + +On Jul 13, 2005, at 2:17 PM, Stephen Frost wrote: +> +> Could you come up w/ a test case that others could reproduce where +> explain isn't returning? + +This was simply due to my n00bness :) I had always been doing +explain analyze, instead of just explain. Next time one of these +queries comes up, I will be sure to do the explain without analyze. + +FYI that update query I mentioned in the initial thread just finished +after updating 8.3 million rows. + +-Dan + + +From pgsql-performance-owner@postgresql.org Wed Jul 13 17:40:06 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id ACEA752C9C + for ; + Wed, 13 Jul 2005 17:40:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58063-09 + for ; + Wed, 13 Jul 2005 20:39:58 +0000 (GMT) +Received: from cmailm1.svr.pol.co.uk (cmailm1.svr.pol.co.uk [195.92.193.18]) + by svr1.postgresql.org (Postfix) with ESMTP id B58FC52B23 + for ; + Wed, 13 Jul 2005 17:39:56 -0300 (ADT) +Received: from modem-875.llama.dialup.pol.co.uk ([217.135.179.107] + helo=192.168.0.102) by cmailm1.svr.pol.co.uk with esmtp (Exim 4.41) + id 1Dso1M-0000RA-5I; Wed, 13 Jul 2005 21:39:56 +0100 +Subject: Re: cost-based vacuum +From: Simon Riggs +To: Tom Lane +Cc: Ian Westmacott , + pgsql-performance@postgresql.org +In-Reply-To: <20659.1121281132@sss.pgh.pa.us> +References: <1120839902.20657.197.camel@spectre.intellivid.com> + <1121081504.3970.53.camel@localhost.localdomain> + <1121087266.27427.35.camel@spectre.intellivid.com> + <1121093488.3970.70.camel@localhost.localdomain> + <1121154338.3970.106.camel@localhost.localdomain> + <1121190651.10346.342.camel@spectre.intellivid.com> + <1121270150.3970.256.camel@localhost.localdomain> + <1121280036.13208.8.camel@spectre.intellivid.com> + <20659.1121281132@sss.pgh.pa.us> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Wed, 13 Jul 2005 21:39:48 +0100 +Message-Id: <1121287188.3970.296.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/153 +X-Sequence-Number: 13394 + +On Wed, 2005-07-13 at 14:58 -0400, Tom Lane wrote: +> Ian Westmacott writes: +> > On Wed, 2005-07-13 at 11:55, Simon Riggs wrote: +> >> On Tue, 2005-07-12 at 13:50 -0400, Ian Westmacott wrote: +> >>> It appears not to matter whether it is one of the tables +> >>> being written to that is ANALYZEd. I can ANALYZE an old, +> >>> quiescent table, or a system table and see this effect. +> >> +> >> Can you confirm that this effect is still seen even when the ANALYZE +> >> doesn't touch *any* of the tables being accessed? +> +> > Yes. +> +> This really isn't making any sense at all. + +Agreed. I think all of this indicates that some wierdness (technical +term) is happening at a different level in the computing stack. I think +all of this points fairly strongly to it *not* being a PostgreSQL +algorithm problem, i.e. if the code was executed by an idealised Knuth- +like CPU then we would not get this problem. Plus, I have faith that if +it was a problem in that "plane" then you or another would have +uncovered it by now. + +> However, these certainly do not explain Ian's problem, because (a) these +> only apply to VACUUM, not ANALYZE; (b) they would only lock the table +> being VACUUMed, not other ones; (c) if these locks were to block the +> reader or writer thread, it'd manifest as blocking on a semaphore, not +> as a surge in LWLock thrashing. + +I've seen enough circumstantial evidence to connect the time spent +inside LWLockAcquire/Release as being connected to the Semaphore ops +within them, not the other aspects of the code. + +Months ago we discussed the problem of false sharing on closely packed +arrays of shared variables because of the large cache line size of the +Xeon MP. When last we touched on that thought, I focused on the thought +that the LWLock array was too tightly packed for the predefined locks. +What we didn't discuss (because I was too focused on the other array) +was the PGPROC shared array is equally tightly packed, which could give +problems on the semaphores in LWLock. + +Intel says fairly clearly that this would be an issue. + +> >> Is that Xeon MP then? +> +> > Yes. +> +> The LWLock activity is certainly suggestive of prior reports of +> excessive buffer manager lock contention, but it makes *no* sense that +> that would be higher with vacuum cost delay than without. I'd have +> expected the other way around. +> +> I'd really like to see a test case for this... + +My feeling is that a "micro-architecture" test would be more likely to +reveal some interesting information. + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Wed Jul 13 17:49:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D854A52CAB + for ; + Wed, 13 Jul 2005 17:49:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58751-09 + for ; + Wed, 13 Jul 2005 20:49:31 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id A231E52B1A + for ; + Wed, 13 Jul 2005 17:49:30 -0300 (ADT) +Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) + by yertle.kcilink.com (Postfix) with ESMTP id 5353FB80C + for ; + Wed, 13 Jul 2005 16:49:32 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v733) +In-Reply-To: +References: +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-7--900832296; + protocol="application/pkcs7-signature" +Message-Id: +From: Vivek Khera +Subject: Re: Quad Opteron stuck in the mud +Date: Wed, 13 Jul 2005 16:49:31 -0400 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.733) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.023 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/154 +X-Sequence-Number: 13395 + + +--Apple-Mail-7--900832296 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + delsp=yes; + format=flowed + + +On Jul 13, 2005, at 2:54 PM, Dan Harris wrote: + +> 4 x 2.2GHz Opterons +> 12 GB of RAM +> 4x10k 73GB Ultra320 SCSI drives in RAID 0+1 +> 1GB hardware cache memory on the RAID controller +> + +if it is taking that long to update about 25% of your table, then you +must be I/O bound. check I/o while you're running a big query. + +also, what RAID controller are you running? be sure you have the +latest BIOS and drivers for it. + +on a pair of dual opterons, I can do large operations on tables with +100 million rows much faster than you seem to be able. I have +MegaRAID 320-2x controllers with 15kRPM drives. + +Vivek Khera, Ph.D. ++1-301-869-4449 x806 + + + +--Apple-Mail-7--900832296 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w +ggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0 +ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcx +KDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0 +ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxA +dGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTlaMGIxCzAJBgNVBAYTAlpB +MSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUg +UGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA +xKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6YfK/Uc4B1OVQCjDXAmNaLIkVcI7d +yfArhVqqP3FWy688Cwfn8R+RNiQqE88r1fOCdz0Dviv+uxg+B79AgAJk16emu59l0cUqVIUPSAR/ +p7bRPGEEQB5kGXJgt/sCAwEAAaOBlDCBkTASBgNVHRMBAf8ECDAGAQH/AgEAMEMGA1UdHwQ8MDow +OKA2oDSGMmh0dHA6Ly9jcmwudGhhd3RlLmNvbS9UaGF3dGVQZXJzb25hbEZyZWVtYWlsQ0EuY3Js +MAsGA1UdDwQEAwIBBjApBgNVHREEIjAgpB4wHDEaMBgGA1UEAxMRUHJpdmF0ZUxhYmVsMi0xMzgw +DQYJ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ZZJqihKYEbN56cF +0/28b4j7WiggQM7OwrDRpBVlcKlbrtGijL55WJiUAgLylVdFh7yzkomVViwNvPUM2OofjVgUFMY7 +olpGFMVeTvRl/5/neXw6xeN3uOT/i2rzOQRPZf60YKrpYSUvJCHyIb7CFzlbtnynPRhlIFcdtYuD +EuehnXgghJNUJgdrB8W71g+8NwAAAAAAAA== + +--Apple-Mail-7--900832296-- + +From pgsql-performance-owner@postgresql.org Wed Jul 13 18:46:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C4591529C2 + for ; + Wed, 13 Jul 2005 18:46:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 72280-02 + for ; + Wed, 13 Jul 2005 21:46:09 +0000 (GMT) +Received: from mailhost.intellivid.com (mailhost.intellivid.com + [64.32.200.11]) + by svr1.postgresql.org (Postfix) with ESMTP id 7690D52ADE + for ; + Wed, 13 Jul 2005 18:46:08 -0300 (ADT) +Received: from [192.168.2.68] (spectre.intellivid.com [192.168.2.68]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (Client did not present a certificate) + by newmail.intellivid.com (Postfix) with ESMTP id C60D6F1829E; + Wed, 13 Jul 2005 17:46:10 -0400 (EDT) +Subject: Re: cost-based vacuum +From: Ian Westmacott +To: Simon Riggs +Cc: Tom Lane , pgsql-performance@postgresql.org +In-Reply-To: <1121287188.3970.296.camel@localhost.localdomain> +References: <1120839902.20657.197.camel@spectre.intellivid.com> + <1121081504.3970.53.camel@localhost.localdomain> + <1121087266.27427.35.camel@spectre.intellivid.com> + <1121093488.3970.70.camel@localhost.localdomain> + <1121154338.3970.106.camel@localhost.localdomain> + <1121190651.10346.342.camel@spectre.intellivid.com> + <1121270150.3970.256.camel@localhost.localdomain> + <1121280036.13208.8.camel@spectre.intellivid.com> + <20659.1121281132@sss.pgh.pa.us> + <1121287188.3970.296.camel@localhost.localdomain> +Content-Type: text/plain +Organization: Intellivid Corp. +Message-Id: <1121291170.13208.25.camel@spectre.intellivid.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 +Date: Wed, 13 Jul 2005 17:46:10 -0400 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/155 +X-Sequence-Number: 13396 + +I can at least report that the problem does not seem to +occur with Postgres 8.0.1 running on a dual Opteron. + + --Ian + + +On Wed, 2005-07-13 at 16:39, Simon Riggs wrote: +> On Wed, 2005-07-13 at 14:58 -0400, Tom Lane wrote: +> > Ian Westmacott writes: +> > > On Wed, 2005-07-13 at 11:55, Simon Riggs wrote: +> > >> On Tue, 2005-07-12 at 13:50 -0400, Ian Westmacott wrote: +> > >>> It appears not to matter whether it is one of the tables +> > >>> being written to that is ANALYZEd. I can ANALYZE an old, +> > >>> quiescent table, or a system table and see this effect. +> > >> +> > >> Can you confirm that this effect is still seen even when the ANALYZE +> > >> doesn't touch *any* of the tables being accessed? +> > +> > > Yes. +> > +> > This really isn't making any sense at all. +> +> Agreed. I think all of this indicates that some wierdness (technical +> term) is happening at a different level in the computing stack. I think +> all of this points fairly strongly to it *not* being a PostgreSQL +> algorithm problem, i.e. if the code was executed by an idealised Knuth- +> like CPU then we would not get this problem. Plus, I have faith that if +> it was a problem in that "plane" then you or another would have +> uncovered it by now. +> +> > However, these certainly do not explain Ian's problem, because (a) these +> > only apply to VACUUM, not ANALYZE; (b) they would only lock the table +> > being VACUUMed, not other ones; (c) if these locks were to block the +> > reader or writer thread, it'd manifest as blocking on a semaphore, not +> > as a surge in LWLock thrashing. +> +> I've seen enough circumstantial evidence to connect the time spent +> inside LWLockAcquire/Release as being connected to the Semaphore ops +> within them, not the other aspects of the code. +> +> Months ago we discussed the problem of false sharing on closely packed +> arrays of shared variables because of the large cache line size of the +> Xeon MP. When last we touched on that thought, I focused on the thought +> that the LWLock array was too tightly packed for the predefined locks. +> What we didn't discuss (because I was too focused on the other array) +> was the PGPROC shared array is equally tightly packed, which could give +> problems on the semaphores in LWLock. +> +> Intel says fairly clearly that this would be an issue. +> +> > >> Is that Xeon MP then? +> > +> > > Yes. +> > +> > The LWLock activity is certainly suggestive of prior reports of +> > excessive buffer manager lock contention, but it makes *no* sense that +> > that would be higher with vacuum cost delay than without. I'd have +> > expected the other way around. +> > +> > I'd really like to see a test case for this... +> +> My feeling is that a "micro-architecture" test would be more likely to +> reveal some interesting information. +> +> Best Regards, Simon Riggs +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend + + +From pgsql-performance-owner@postgresql.org Fri Jul 15 02:08:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 64BA952D61 + for ; + Thu, 14 Jul 2005 23:08:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62506-04 + for ; + Fri, 15 Jul 2005 02:08:14 +0000 (GMT) +Received: from hub.org (hub.org [200.46.204.220]) + by svr1.postgresql.org (Postfix) with ESMTP id CAFD552D26 + for ; + Thu, 14 Jul 2005 23:08:14 -0300 (ADT) +Received: from localhost (unknown [200.46.204.144]) + by hub.org (Postfix) with ESMTP id 2D99CA246A4 + for ; + Thu, 14 Jul 2005 23:08:14 -0300 (ADT) +Received: from hub.org ([200.46.204.220]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62363-08 for ; + Fri, 15 Jul 2005 02:08:13 +0000 (GMT) +Received: from ganymede.hub.org (blk-224-176-51.eastlink.ca [24.224.176.51]) + by hub.org (Postfix) with ESMTP id 831A6A246C4 + for ; + Thu, 14 Jul 2005 23:08:12 -0300 (ADT) +Received: by ganymede.hub.org (Postfix, from userid 1000) + id 707C33DEB3; Thu, 14 Jul 2005 23:08:23 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by ganymede.hub.org (Postfix) with ESMTP id 66F3B3CEE4 + for ; + Thu, 14 Jul 2005 23:08:23 -0300 (ADT) +X-Return-Path: +X-Received: from localhost ([unix socket]) + by ganymede.hub.org (Cyrus v2.2.12) with LMTPA; + Wed, 13 Jul 2005 19:36:18 -0300 +X-Sieve: CMU Sieve 2.2 +X-Received: from localhost (localhost [127.0.0.1]) + by ganymede.hub.org (Postfix) with ESMTP id 9C4B73846E + for ; Wed, 13 Jul 2005 19:35:34 -0300 (ADT) +X-Received: from mail.postgresql.org [200.46.204.71] + by localhost with IMAP (fetchmail-6.2.5) + for scrappy@localhost (single-drop); + Wed, 13 Jul 2005 19:35:34 -0300 (ADT) +X-Received: from svr1.postgresql.org ([unix socket]) + by svr1.postgresql.org (Cyrus v2.2.12) with LMTPA; + Wed, 13 Jul 2005 19:35:14 -0300 +X-Sieve: CMU Sieve 2.2 +X-Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EA83752C3B + for ; Wed, 13 Jul 2005 19:35:13 -0300 (ADT) +X-Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76830-09 for ; + Wed, 13 Jul 2005 22:35:11 +0000 (GMT) +X-Received: from nextmail.ru (unknown [83.222.5.149]) + by svr1.postgresql.org (Postfix) with SMTP id D720952C2C + for ; + Wed, 13 Jul 2005 19:35:09 -0300 (ADT) +X-Received: (qmail 44456 invoked from network); 13 Jul 2005 22:34:01 -0000 +X-Received: from ppp85-140-125-114.pppoe.mtu-net.ru (HELO z) (85.140.125.114) + by nextmail.ru with SMTP; 13 Jul 2005 22:34:01 -0000 +From: "jobapply" +To: +Subject: Functional index is 5 times slower than the basic one +Date: Thu, 14 Jul 2005 02:35:10 +0400 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Mailer: Microsoft Office Outlook, Build 11.0.6353 +Thread-Index: AcWH+yAUOw6G+W3wThu3dWh4z4ubKA== +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +Message-Id: <20050713223509.D720952C2C@svr1.postgresql.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-DCC: : +X-Spam-Pyzor: Reported 0 times. +ReSent-Date: Thu, 14 Jul 2005 23:08:18 -0300 (ADT) +Resent-From: "Marc G. Fournier" +Resent-To: pgsql-performance@postgresql.org +ReSent-Subject: Functional index is 5 times slower than the basic one +ReSent-Message-ID: <20050714230818.L66818@ganymede.hub.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.588 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/210 +X-Sequence-Number: 13451 + +VACUUM FULL ANALYZE is performed right before tests. +UPDATE test SET t = xpath_string(x, 'movie/rating'::text); is performed also +to make selects equal. +Xpath_string is IMMUTABLE. + + Table "public.test" + Column | Type | Modifiers | Description +--------+------------------+-----------+------------- + i | integer | | + t | text | | + x | text | | + d | double precision | | +Indexes: + "floatind" btree (d) + "i_i" btree (i) CLUSTER + "t_ind" btree (t) + "t_x_ind" btree (t, xpath_string(x, 'data'::text)) + "x_i" btree (xpath_string(x, 'data'::text)) + "x_ii" btree (xpath_string(x, 'movie/characters/character'::text)) + "x_iii" btree (xpath_string(x, 'movie/rating'::text)) +Has OIDs: no + +explain analyze select count(*) from ( + select * from test order by xpath_string(x, 'movie/rating'::text) +limit 1000 offset 10 +) a; + + + +QUERY PLAN +Aggregate (cost=342.37..342.37 rows=1 width=0) (actual +time=403.580..403.584 rows=1 loops=1) +-> Subquery Scan a (cost=3.27..339.87 rows=1000 width=0) (actual +time=4.252..398.261 rows=1000 loops=1) +-> Limit (cost=3.27..329.87 rows=1000 width=969) (actual +time=4.242..389.557 rows=1000 loops=1) +-> Index Scan using x_iii on test (cost=0.00..3266.00 rows=10000 +width=969) (actual time=0.488..381.049 rows=1010 loops=1) + Total runtime: 403.695 ms + + +explain analyze select count(*) from ( + select * from test order by t limit 1000 offset 10 +) a; + + +QUERY PLAN +Aggregate (cost=339.84..339.84 rows=1 width=0) (actual time=26.662..26.666 +rows=1 loops=1) +-> Subquery Scan a (cost=3.24..337.34 rows=1000 width=0) (actual +time=0.228..22.416 rows=1000 loops=1) +-> Limit (cost=3.24..327.34 rows=1000 width=969) (actual +time=0.217..14.244 rows=1000 loops=1) +-> Index Scan using t_ind on test (cost=0.00..3241.00 rows=10000 +width=969) (actual time=0.099..6.371 rows=1010 loops=1) + Total runtime: 26.749 ms + + +From pgsql-performance-owner@postgresql.org Wed Jul 13 19:51:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AB12B52A00 + for ; + Wed, 13 Jul 2005 19:51:35 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81225-09 + for ; + Wed, 13 Jul 2005 22:51:26 +0000 (GMT) +Received: from cmailm4.svr.pol.co.uk (cmailm4.svr.pol.co.uk [195.92.193.211]) + by svr1.postgresql.org (Postfix) with ESMTP id A1D0D52800 + for ; + Wed, 13 Jul 2005 19:51:26 -0300 (ADT) +Received: from modem-430.llama.dialup.pol.co.uk ([217.135.177.174] + helo=192.168.0.102) by cmailm4.svr.pol.co.uk with esmtp (Exim 4.41) + id 1Dsq4a-0005eR-Bg; Wed, 13 Jul 2005 23:51:24 +0100 +Subject: Re: Quad Opteron stuck in the mud +From: Simon Riggs +To: Dan Harris +Cc: pgsql-performance@postgresql.org +In-Reply-To: +References: +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Wed, 13 Jul 2005 23:51:16 +0100 +Message-Id: <1121295076.3970.381.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/156 +X-Sequence-Number: 13397 + +On Wed, 2005-07-13 at 12:54 -0600, Dan Harris wrote: +> For example, as I'm writing this, I am running an UPDATE statement +> that will affect a small part of the table, and is querying on an +> indexed boolean field. + +An indexed boolean field? + +Hopefully, ftindex is false for very few rows of the table? + +Try changing the ftindex to be a partial index, so only index the false +values. Or don't index it at all. + +Split the table up into smaller pieces. + +Don't use an UPDATE statement. Keep a second table, and insert records +into it when you would have updated previously. If a row is not found, +you know that it has ftindex=true. That way, you'll never have row +versions building up in the main table, which you'll still get even if +you VACUUM. + +Best Regards, Simon Riggs + + + + +From pgsql-performance-owner@postgresql.org Fri Jul 15 02:05:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0D87552D38 + for ; + Wed, 13 Jul 2005 23:53:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39299-01 + for ; + Thu, 14 Jul 2005 02:53:21 +0000 (GMT) +Received: from hub.org (hub.org [200.46.204.220]) + by svr1.postgresql.org (Postfix) with ESMTP id 1026152D0C + for ; + Wed, 13 Jul 2005 23:53:21 -0300 (ADT) +Received: from localhost (unknown [200.46.204.144]) + by hub.org (Postfix) with ESMTP id 83402A246B6 + for ; + Wed, 13 Jul 2005 23:53:20 -0300 (ADT) +Received: from hub.org ([200.46.204.220]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39255-01 for ; + Thu, 14 Jul 2005 02:53:18 +0000 (GMT) +Received: from ganymede.hub.org (blk-224-176-51.eastlink.ca [24.224.176.51]) + by hub.org (Postfix) with ESMTP id DCB35A246AF + for ; + Wed, 13 Jul 2005 23:53:17 -0300 (ADT) +Received: by ganymede.hub.org (Postfix, from userid 1000) + id 2DB8434EC9; Wed, 13 Jul 2005 23:53:29 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by ganymede.hub.org (Postfix) with ESMTP id 2807534584 + for ; + Wed, 13 Jul 2005 23:53:29 -0300 (ADT) +X-Return-Path: +X-Received: from localhost ([unix socket]) + by ganymede.hub.org (Cyrus v2.2.12) with LMTPA; + Wed, 13 Jul 2005 20:50:42 -0300 +X-Sieve: CMU Sieve 2.2 +X-Received: from localhost (localhost [127.0.0.1]) + by ganymede.hub.org (Postfix) with ESMTP id 5427A3D65A + for ; Wed, 13 Jul 2005 20:50:23 -0300 (ADT) +X-Received: from mail.postgresql.org [200.46.204.71] + by localhost with IMAP (fetchmail-6.2.5) + for scrappy@localhost (single-drop); + Wed, 13 Jul 2005 20:50:23 -0300 (ADT) +X-Received: from svr1.postgresql.org ([unix socket]) + by svr1.postgresql.org (Cyrus v2.2.12) with LMTPA; + Wed, 13 Jul 2005 20:46:31 -0300 +X-Sieve: CMU Sieve 2.2 +X-Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B1FA452C58 + for ; Wed, 13 Jul 2005 20:46:31 -0300 (ADT) +X-Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95818-02 for ; + Wed, 13 Jul 2005 23:46:23 +0000 (GMT) +X-Received: from nextmail.ru (unknown [83.222.5.149]) + by svr1.postgresql.org (Postfix) with SMTP id 302A952C5D + for ; + Wed, 13 Jul 2005 20:46:21 -0300 (ADT) +X-Received: (qmail 24036 invoked from network); 13 Jul 2005 23:45:15 -0000 +X-Received: from ppp85-140-125-114.pppoe.mtu-net.ru (HELO z) (85.140.125.114) + by nextmail.ru with SMTP; 13 Jul 2005 23:45:15 -0000 +From: "jobapply" +To: +Subject: Indexing Function called on VACUUM and sorting ? +Date: Thu, 14 Jul 2005 03:46:23 +0400 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Mailer: Microsoft Office Outlook, Build 11.0.6353 +Thread-Index: AcWIBRPH0sxvB4uyS7CMZ6QrhZOEzw== +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +Message-Id: <20050713234621.302A952C5D@svr1.postgresql.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-DCC: : +X-Spam-Pyzor: Reported 0 times. +ReSent-Date: Wed, 13 Jul 2005 23:53:21 -0300 (ADT) +Resent-From: "Marc G. Fournier" +Resent-To: pgsql-performance@postgresql.org +ReSent-Subject: Indexing Function called on VACUUM and sorting ? +ReSent-Message-ID: <20050713235321.A66818@ganymede.hub.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.946 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/205 +X-Sequence-Number: 13446 + + +The question appeared because of strange issues with functional indexes. +It seems they are recalculated even where it is obviously not needed. + +\d+ test: + + i | integer | | + t | text | | + x | text | | + "i_i" btree (i) + "x_i" btree (xpath_string(x, 'data'::text)) + "x_ii" btree (xpath_string(x, 'movie/characters/character'::text)) + "x_iii" btree (xpath_string(x, 'movie/rating'::text)) + + +1) +When I run +VACUUM FULL ANALYZE VERBOSE +OR +VACUUM ANALYZE + +After text + +INFO: analyzing "public.test" +INFO: "test": scanned 733 of 733 pages, containing 10000 live rows and 0 +dead rows; 3000 rows in sample, 10000 estimated total rows + +a lot of xpath_string calls occur. +Does VACUUM rebuild indexes ? What for to recalculate that all? +It makes VACUUMing very slow. + +Simple VACUUM call does not lead to such function calls. + +2) +When I do +select * from test order by xpath_string(x, 'movie/rating'::text) limit 1000 +offset 10; + +Planner uses index x_iii (as it should, ok here): Limit -> Index scan. +But many of calls to xpath_string occur in execution time. +Why ? Index is calculated already and everything is so immutable.. + + +Please answer if you have any ideas.. Functional indexes seemed so great +first, but now I uncover weird issues I can't understand.. + + + + + + +From pgsql-performance-owner@postgresql.org Wed Jul 13 21:07:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 19D9752BC8 + for ; + Wed, 13 Jul 2005 21:07:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93839-10 + for ; + Thu, 14 Jul 2005 00:07:47 +0000 (GMT) +Received: from intranet.squiz.net (extranet.squiz.net [203.222.154.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F14CF52A78 + for ; + Wed, 13 Jul 2005 21:07:45 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by intranet.squiz.net (Postfix) with ESMTP id AEA3337856; + Thu, 14 Jul 2005 10:07:39 +1000 (EST) +Received: from intranet.squiz.net ([127.0.0.1]) + by localhost (intranet [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 01852-04; Thu, 14 Jul 2005 10:07:39 +1000 (EST) +Received: from [192.168.0.116] (116.squiz.net [192.168.0.116]) + by intranet.squiz.net (Postfix) with ESMTP id 53641376E0 + for ; + Thu, 14 Jul 2005 10:07:39 +1000 (EST) +Message-ID: <42D5AC8A.9000003@squiz.net> +Date: Thu, 14 Jul 2005 10:06:34 +1000 +From: Marc McIntyre +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Slow Query +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at squiz.net +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/157 +X-Sequence-Number: 13398 + +Hi, + +I'm having a problem with a query that performs a sequential scan on a +table when it should be performing an index scan. The interesting thing +is, when we dumped the database on another server, it performed an index +scan on that server. The systems are running the same versions of +postgres (7.4.8) and the problem persists after running an "ANALYZE +VERBOSE" and after a "REINDEX TABLE sq_ast FORCE". The only difference +that i can see is that the postgresql.conf files differ slightly, and +the hardware is different. Note that the system performing the +sequential scan is a Dual 2.8GHz Xeon, 4GB Ram, 300GB HDD. And the +system performing an index scan is not as powerful. + +A copy of the postgresql.conf for the system performing the index scan +can be found at http://beta.squiz.net/~mmcintyre/postgresql_squiz_uk.conf +A copy of the postgresql.conf for the system performing the sequential +scan can be found at http://beta.squiz.net/~mmcintyre/postgresql_future.conf + +The Query: + +SELECT a.assetid, a.short_name, a.type_code, a.status, l.linkid, +l.link_type, l.sort_order, lt.num_kids, u.url, ap.path, + CASE u.http + WHEN '1' THEN 'http' + WHEN '0' THEN 'https' + END AS protocol +FROM ((sq_ast a LEFT JOIN sq_ast_url u ON a.assetid = u.assetid) LEFT +JOIN sq_ast_path ap ON a.assetid = ap.assetid),sq_ast_lnk l, +sq_ast_lnk_tree lt WHERE a.assetid = l.minorid AND + l.linkid = lt.linkid AND l.majorid = '2' AND + l.link_type <= 2 ORDER BY sort_order + + +The EXPLAIN ANALYZE from the system performing an sequential scan: + +QUERY PLAN +Sort (cost=30079.79..30079.89 rows=42 width=113) (actual time=39889.989..39890.346 rows=260 loops=1) + Sort Key: l.sort_order + -> Nested Loop (cost=25638.02..30078.65 rows=42 width=113) (actual time=9056.336..39888.557 rows=260 loops=1) + -> Merge Join (cost=25638.02..29736.01 rows=25 width=109) (actual time=9056.246..39389.359 rows=260 loops=1) + Merge Cond: (("outer".assetid)::text = "inner"."?column5?") + -> Merge Left Join (cost=25410.50..29132.82 rows=150816 width=97) (actual time=8378.176..38742.111 rows=150567 loops=1) + Merge Cond: (("outer".assetid)::text = ("inner".assetid)::text) + -> Merge Left Join (cost=25410.50..26165.14 rows=150816 width=83) (actual time=8378.130..9656.413 rows=150489 loops=1) + Merge Cond: ("outer"."?column5?" = "inner"."?column4?") + -> Sort (cost=25408.17..25785.21 rows=150816 width=48) (actual time=8377.733..8609.218 rows=150486 loops=1) + Sort Key: (a.assetid)::text + -> Seq Scan on sq_ast a (cost=0.00..12436.16 rows=150816 width=48) (actual time=0.011..5578.231 rows=151378 loops=1) + -> Sort (cost=2.33..2.43 rows=37 width=43) (actual time=0.364..0.428 rows=37 loops=1) + Sort Key: (u.assetid)::text + -> Seq Scan on sq_ast_url u (cost=0.00..1.37 rows=37 width=43) (actual time=0.023..0.161 rows=37 loops=1) + -> Index Scan using sq_ast_path_ast on sq_ast_path ap (cost=0.00..2016.98 rows=45893 width=23) (actual time=0.024..14041.571 rows=45812 loops=1) + -> Sort (cost=227.52..227.58 rows=25 width=21) (actual time=131.838..132.314 rows=260 loops=1) + Sort Key: (l.minorid)::text + -> Index Scan using sq_ast_lnk_majorid on sq_ast_lnk l (cost=0.00..226.94 rows=25 width=21) (actual time=0.169..126.201 rows=260 loops=1) + Index Cond: ((majorid)::text = '2'::text) + Filter: (link_type <= 2) + -> Index Scan using sq_ast_lnk_tree_linkid on sq_ast_lnk_tree lt (cost=0.00..13.66 rows=3 width=8) (actual time=1.539..1.900 rows=1 loops=260) + Index Cond: ("outer".linkid = lt.linkid) +Total runtime: 39930.395 ms + + +The EXPLAIN ANALYZE from the system performing an index scan scan: + + +Sort (cost=16873.64..16873.74 rows=40 width=113) (actual time=2169.905..2169.912 rows=13 loops=1) + Sort Key: l.sort_order + -> Nested Loop (cost=251.39..16872.58 rows=40 width=113) (actual time=45.724..2169.780 rows=13 loops=1) + -> Merge Join (cost=251.39..16506.42 rows=32 width=109) (actual time=45.561..2169.012 rows=13 loops=1) + Merge Cond: (("outer".assetid)::text = "inner"."?column5?") + -> Merge Left Join (cost=2.33..15881.92 rows=149982 width=97) (actual time=0.530..1948.718 rows=138569 loops=1) + Merge Cond: (("outer".assetid)::text = ("inner".assetid)::text) + -> Merge Left Join (cost=2.33..13056.04 rows=149982 width=83) (actual time=0.406..953.781 rows=138491 loops=1) + Merge Cond: (("outer".assetid)::text = "inner"."?column4?") + -> Index Scan using sq_ast_pkey on sq_ast a (cost=0.00..14952.78 rows=149982 width=48) (actual time=0.154..388.872 rows=138488 loops=1) + -> Sort (cost=2.33..2.43 rows=37 width=43) (actual time=0.235..0.264 rows=37 loops=1) + Sort Key: (u.assetid)::text + -> Seq Scan on sq_ast_url u (cost=0.00..1.37 rows=37 width=43) (actual time=0.036..0.103 rows=37 loops=1) + -> Index Scan using sq_ast_path_ast on sq_ast_path ap (cost=0.00..1926.18 rows=42071 width=23) (actual time=0.110..105.918 rows=42661 loops=1) + -> Sort (cost=249.05..249.14 rows=36 width=21) (actual time=0.310..0.324 rows=13 loops=1) + Sort Key: (l.minorid)::text + -> Index Scan using sq_ast_lnk_majorid on sq_ast_lnk l (cost=0.00..248.12 rows=36 width=21) (actual time=0.141..0.282 rows=13 loops=1) + Index Cond: ((majorid)::text = '2'::text) + Filter: (link_type <= 2) + -> Index Scan using sq_ast_lnk_tree_linkid on sq_ast_lnk_tree lt (cost=0.00..11.41 rows=2 width=8) (actual time=0.043..0.045 rows=1 loops=13) + Index Cond: ("outer".linkid = lt.linkid) + Total runtime: 2170.165 ms +(22 rows) + +THE DESC of the sq_ast table. + + +future_v3_schema=# \d sq_ast + + Table "public.sq_ast" + Column | Type | Modifiers +-----------------------+-----------------------------+--------------------------------------------- + assetid | character varying(15) | not null + type_code | character varying(100) | not null + version | character varying(20) | not null default '0.0.0'::character +varying + name | character varying(255) | not null default ''::character varying + short_name | character varying(255) | not null default ''::character +varying + status | integer | not null default 1 + languages | character varying(50) | not null default ''::character varying + charset | character varying(50) | not null default ''::character varying + force_secure | character(1) | not null default '0'::bpchar + created | timestamp without time zone | not null + created_userid | character varying(255) | not null + updated | timestamp without time zone | not null + updated_userid | character varying(255) | not null + published | timestamp without time zone | + published_userid | character varying(255) | + status_changed | timestamp without time zone | + status_changed_userid | character varying(255) | +Indexes: + "sq_asset_pkey" primary key, btree (assetid) + "sq_ast_created" btree (created) + "sq_ast_name" btree (name) + "sq_ast_published" btree (published) + "sq_ast_type_code" btree (type_code) + "sq_ast_updated" btree (updated) + + +Any ideas? + +-- +Marc McIntyre +MySource Matrix Lead Developer + + + +From pgsql-performance-owner@postgresql.org Fri Jul 15 02:08:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7BB6D52B1A + for ; + Wed, 13 Jul 2005 22:07:36 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 15054-01 + for ; + Thu, 14 Jul 2005 01:07:34 +0000 (GMT) +Received: from hub.org (hub.org [200.46.204.220]) + by svr1.postgresql.org (Postfix) with ESMTP id AA43752B27 + for ; + Wed, 13 Jul 2005 22:07:34 -0300 (ADT) +Received: from localhost (unknown [200.46.204.144]) + by hub.org (Postfix) with ESMTP id 5431FA246A4 + for ; + Wed, 13 Jul 2005 22:07:34 -0300 (ADT) +Received: from hub.org ([200.46.204.220]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11806-08 for ; + Thu, 14 Jul 2005 01:07:02 +0000 (GMT) +Received: from ganymede.hub.org (blk-224-176-51.eastlink.ca [24.224.176.51]) + by hub.org (Postfix) with ESMTP id 328A9A24653 + for ; + Wed, 13 Jul 2005 22:07:02 -0300 (ADT) +Received: by ganymede.hub.org (Postfix, from userid 1000) + id 423AF3C282; Wed, 13 Jul 2005 22:07:12 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by ganymede.hub.org (Postfix) with ESMTP id 416D93C1F0 + for ; + Wed, 13 Jul 2005 22:07:12 -0300 (ADT) +X-Return-Path: +X-Received: from localhost ([unix socket]) + by ganymede.hub.org (Cyrus v2.2.12) with LMTPA; + Wed, 13 Jul 2005 21:25:47 -0300 +X-Sieve: CMU Sieve 2.2 +X-Received: from localhost (localhost [127.0.0.1]) + by ganymede.hub.org (Postfix) with ESMTP id 84B4D3E9D7 + for ; Wed, 13 Jul 2005 21:25:27 -0300 (ADT) +X-Received: from mail.postgresql.org [200.46.204.71] + by localhost with IMAP (fetchmail-6.2.5) + for scrappy@localhost (single-drop); + Wed, 13 Jul 2005 21:25:27 -0300 (ADT) +X-Received: from svr1.postgresql.org ([unix socket]) + by svr1.postgresql.org (Cyrus v2.2.12) with LMTPA; + Wed, 13 Jul 2005 21:21:34 -0300 +X-Sieve: CMU Sieve 2.2 +X-Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C2E9B52B23 + for ; Wed, 13 Jul 2005 21:21:34 -0300 (ADT) +X-Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02320-08 for ; + Thu, 14 Jul 2005 00:21:33 +0000 (GMT) +X-Received: from gghcwest.com (adsl-71-128-90-172.dsl.pltn13.pacbell.net + [71.128.90.172]) + by svr1.postgresql.org (Postfix) with ESMTP id E2C8452B1A + for ; Wed, 13 Jul 2005 21:21:31 -0300 (ADT) +X-Received: from toonses.gghcwest.com (toonses.gghcwest.com [192.168.168.115]) + by gghcwest.com (8.12.10/8.12.9) with ESMTP id j6E0LVmd013717 + for ; Wed, 13 Jul 2005 17:21:31 -0700 +X-Received: from jwb by toonses.gghcwest.com with local (Exim 4.50) + id 1DsrSZ-0005da-FH + for pgsql-users@postgresql.org; Wed, 13 Jul 2005 17:20:15 -0700 +Subject: JFS fastest filesystem for PostgreSQL? +From: "Jeffrey W. Baker" +To: pgsql-users@postgresql.org +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Date: Wed, 13 Jul 2005 17:20:15 -0700 +Message-Id: <1121300415.20950.33.camel@toonses.gghcwest.com> +Mime-Version: 1.0 +X-Mailer: Evolution 2.3.4 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-DCC: : +X-Spam-Pyzor: Reported 0 times. +ReSent-Date: Wed, 13 Jul 2005 22:07:04 -0300 (ADT) +Resent-From: "Marc G. Fournier" +Resent-To: pgsql-performance@postgresql.org +ReSent-Subject: JFS fastest filesystem for PostgreSQL? +ReSent-Message-ID: <20050713220704.V66818@ganymede.hub.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200507/208 +X-Sequence-Number: 13449 + +I just took delivery of a new system, and used the opportunity to +benchmark postgresql 8.0 performance on various filesystems. The system +in question runs Linux 2.6.12, has one CPU and 1GB of system memory, and +5 7200RPM SATA disks attached to an Areca hardware RAID controller +having 128MB of cache. The caches are all write-back. + +I ran pgbench with a scale factor of 1000 and a total of 100,000 +transactions per run. I varied the number of clients between 10 and +100. It appears from my test JFS is much faster than both ext3 and XFS +for this workload. JFS and XFS were made with the mkfs defaults. ext3 +was made with -T largefile4 and -E stride=32. The deadline scheduler +was used for all runs (anticipatory scheduler is much worse). + +Here's the result, in transactions per second. + + ext3 jfs xfs +----------------------------- + 10 Clients 55 81 68 +100 Clients 61 100 64 +---------------------------- + +-jwb + +From pgsql-performance-owner@postgresql.org Thu Jul 14 00:21:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BB43552C5C + for ; + Thu, 14 Jul 2005 00:17:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 49237-03 + for ; + Thu, 14 Jul 2005 03:17:39 +0000 (GMT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by svr1.postgresql.org (Postfix) with ESMTP id 97FAD52824 + for ; + Thu, 14 Jul 2005 00:17:39 -0300 (ADT) +Received: from news.hub.org (news.hub.org [200.46.204.72]) + by news.hub.org (8.13.1/8.13.1) with ESMTP id j6E3HdaS050479 + for ; Thu, 14 Jul 2005 03:17:39 GMT + (envelope-from news@news.hub.org) +Received: (from news@localhost) + by news.hub.org (8.13.1/8.13.1/Submit) id j6E3Do1x049325 + for pgsql-performance@postgresql.org; Thu, 14 Jul 2005 03:13:50 GMT + (envelope-from news) +From: "Qingqing Zhou" +X-Newsgroups: pgsql.performance +Subject: Re: performance problems ... 100 cpu utilization +Date: Thu, 14 Jul 2005 11:11:29 +0800 +Organization: Hub.Org Networking Services +Lines: 31 +Message-ID: +References: <42D567DB.6000100@works4me.com> +Reply-To: "Qingqing Zhou" +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2800.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-Archive-Number: 200507/158 +X-Sequence-Number: 13399 + + +"Dennis" writes +> +> checking the status of connections at this point ( ps -eaf | grep +> "postgres:") where the CPU is maxed out I saw this: +> +> 127 idle +> 12 bind +> 38 parse +> 34 select +> + +Are you sure 100% CPU usage is solely contributed by Postgresql? Also, from +the ps status you list, I can hardly see that's a problem because of problem +you mentioned below. + +> +> I know there has been discussion about problems on Xeon MP systems. Is +> this what we are running into? Or is something else going on? Is there +> other information I can provide that might help determine what is going +on? +> + +Here is a talk about Xeon-SMP spinlock contention problem: +http://archives.postgresql.org/pgsql-performance/2005-05/msg00441.php + + +Regards, +Qingqing + + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 01:28:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6822D52BFD + for ; + Thu, 14 Jul 2005 00:28:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50081-09 + for ; + Thu, 14 Jul 2005 03:28:48 +0000 (GMT) +Received: from lakermmtao11.cox.net (eastrmmtai02.cox.net [68.230.240.28]) + by svr1.postgresql.org (Postfix) with ESMTP id D538752BF7 + for ; + Thu, 14 Jul 2005 00:28:44 -0300 (ADT) +Received: from [127.0.0.1] (really [68.3.22.74]) by lakermmtao11.cox.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050714032840.KSYU28203.lakermmtao11.cox.net@[127.0.0.1]>; + Wed, 13 Jul 2005 23:28:40 -0400 +Message-ID: <42D5DBEB.4010503@works4me.com> +Date: Wed, 13 Jul 2005 20:28:43 -0700 +From: Dennis +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Qingqing Zhou +Cc: pgsql-performance@postgresql.org +Subject: Re: performance problems ... 100 cpu utilization +References: <42D567DB.6000100@works4me.com> +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Antivirus: avast! (VPS 0528-3, 07/13/2005), Outbound message +X-Antivirus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/159 +X-Sequence-Number: 13400 + +Qingqing Zhou wrote: + +>Are you sure 100% CPU usage is solely contributed by Postgresql? Also, from +>the ps status you list, I can hardly see that's a problem because of problem +>you mentioned below. +> +> +The postgreSQL processes are what is taking up all the cpu. There aren't +any other major applications on the machine. Its a dedicated database +server, only for this application. + +It doesn't seem to make sense that PostgreSQL would be maxed out at this +point. I think given the size of the box, it could do quite a bit +better. So, what is going on? I don't know. + +Dennis + +From pgsql-performance-owner@postgresql.org Thu Jul 14 02:07:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9B9E152BF8 + for ; + Thu, 14 Jul 2005 02:07:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70390-06 + for ; + Thu, 14 Jul 2005 05:07:47 +0000 (GMT) +Received: from smtp003.bizmail.yahoo.com (smtp003.bizmail.yahoo.com + [216.136.130.195]) + by svr1.postgresql.org (Postfix) with SMTP id F2EBF52B06 + for ; + Thu, 14 Jul 2005 02:07:45 -0300 (ADT) +Received: (qmail 4619 invoked from network); 14 Jul 2005 05:07:39 -0000 +Received: from unknown (HELO ?192.168.3.41?) + (david.mitchell@telogis.com@203.98.10.169 with plain) + by smtp003.bizmail.yahoo.com with SMTP; 14 Jul 2005 05:07:39 -0000 +Message-ID: <42D5F315.3090301@telogis.com> +Date: Thu, 14 Jul 2005 17:07:33 +1200 +From: David Mitchell +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dennis +Cc: Qingqing Zhou , + pgsql-performance@postgresql.org +Subject: Re: performance problems ... 100 cpu utilization +References: <42D567DB.6000100@works4me.com> + <42D5DBEB.4010503@works4me.com> +In-Reply-To: <42D5DBEB.4010503@works4me.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-Archive-Number: 200507/160 +X-Sequence-Number: 13401 + +What is the load average on this machine? Do you do many updates? If you +do a lot of updates, perhaps you haven't vacuumed recently. We were +seeing similar symptoms when we started load testing our stuff and it +turned out we were vacuuming too infrequently. + +David + +Dennis wrote: +> Qingqing Zhou wrote: +> +>> Are you sure 100% CPU usage is solely contributed by Postgresql? Also, +>> from +>> the ps status you list, I can hardly see that's a problem because of +>> problem +>> you mentioned below. +>> +>> +> The postgreSQL processes are what is taking up all the cpu. There aren't +> any other major applications on the machine. Its a dedicated database +> server, only for this application. +> +> It doesn't seem to make sense that PostgreSQL would be maxed out at this +> point. I think given the size of the box, it could do quite a bit +> better. So, what is going on? I don't know. +> +> Dennis +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> +> + + +-- +David Mitchell +Software Engineer +Telogis + +From pgsql-performance-owner@postgresql.org Thu Jul 14 02:08:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C8E0552C25 + for ; + Thu, 14 Jul 2005 02:08:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71721-09 + for ; + Thu, 14 Jul 2005 05:08:34 +0000 (GMT) +Received: from ash25e.internode.on.net (ash25e.internode.on.net + [203.16.214.182]) + by svr1.postgresql.org (Postfix) with ESMTP id 75E3052BCA + for ; + Thu, 14 Jul 2005 02:08:32 -0300 (ADT) +Received: from pluto.mirrabooka.com (ppp188-133.static.internode.on.net + [150.101.188.133]) + by ash25e.internode.on.net (8.12.9/8.12.6) with ESMTP id j6E58ULj089210 + for ; + Thu, 14 Jul 2005 14:38:31 +0930 (CST) + (envelope-from alison@mirrabooka.com) +Received: by pluto.mirrabooka.com (Postfix, from userid 506) + id 6A4A92B11E; Thu, 14 Jul 2005 15:08:30 +1000 (EST) +Date: Thu, 14 Jul 2005 15:08:30 +1000 +To: pgsql-performance@postgresql.org +Subject: lots of updates on small table +Message-ID: <42D5F34E.nail9QE1195IE@pluto.mirrabooka.com> +User-Agent: nail 11.6 9/7/04 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +From: alison@mirrabooka.com (Alison Winters) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/161 +X-Sequence-Number: 13402 + +Hi, + +Our application requires a number of processes to select and update rows +from a very small (<10 rows) Postgres table on a regular and frequent +basis. These processes often run for weeks at a time, but over the +space of a few days we find that updates start getting painfully slow. +We are running a full vacuum/analyze and reindex on the table every day, +but the updates keep getting slower and slower until the processes are +restarted. Restarting the processes isn't really a viable option in our +24/7 production environment, so we're trying to figure out what's +causing the slow updates. + +The environment is as follows: + +Red Hat 9, kernel 2.4.20-8 +PostgreSQL 7.3.2 +ecpg 2.10.0 + +The processes are all compiled C programs accessing the database using +ECPG. + +Does anyone have any thoughts on what might be happening here? + +Thanks +Alison + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 02:58:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2B30F52C99 + for ; + Thu, 14 Jul 2005 02:58:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84885-05 + for ; + Thu, 14 Jul 2005 05:58:27 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.205]) + by svr1.postgresql.org (Postfix) with ESMTP id E60A152C64 + for ; + Thu, 14 Jul 2005 02:58:25 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id o1so191144nzf + for ; + Wed, 13 Jul 2005 22:58:26 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; + b=JzrDmm93bL/5YERxwfvHqY8pJR22+G4Yk+rsLrzGLscMSeHNjgO+1FE1ZE2NYX8RRYdYjTJFG5jb2d/Yrb+CbSoJz7dHuoZSLsPvHXUVdCiF8r3i3xXiMI5K7tjXtlL2GuHPVzPii1A305bqoKz0vvnKpV9GPCRiJ5RQHFrsu+0= +Received: by 10.36.103.20 with SMTP id a20mr79672nzc; + Wed, 13 Jul 2005 22:58:26 -0700 (PDT) +Received: by 10.36.96.2 with HTTP; Wed, 13 Jul 2005 22:58:26 -0700 (PDT) +Message-ID: <8d1c715f05071322582a27b996@mail.gmail.com> +Date: Thu, 14 Jul 2005 10:58:26 +0500 +From: Agha Asif Raza +Reply-To: Agha Asif Raza +To: pgsql-performance@postgresql.org +Subject: Profiler for PostgreSQL +Mime-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_23643_11673196.1121320706415" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.32 tagged_above=0 required=5 tests=HTML_10_20, + HTML_MESSAGE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/162 +X-Sequence-Number: 13403 + +------=_Part_23643_11673196.1121320706415 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +Is there any MS-SQL Server like 'Profiler' available for PostgreSQL? A=20 +profiler is a tool that monitors the database server and outputs a detailed= +=20 +trace of all the transactions/queries that are executed on a database durin= +g=20 +a specified period of time. Kindly let me know if any of you knows of such = +a=20 +tool for PostgreSQL. + Agha Asif Raza + +------=_Part_23643_11673196.1121320706415 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +
Is there any MS-SQL Server like 'Profiler' available for PostgreSQL? A= + profiler is a tool that monitors the database server and outputs a detaile= +d trace of all the transactions/queries that are executed on a da= +tabase during a specified period of time. Kindly let me know if any of= + you knows of such a tool for PostgreSQL. +
+
 
+
Agha Asif Raza
+ +------=_Part_23643_11673196.1121320706415-- + +From pgsql-performance-owner@postgresql.org Thu Jul 14 03:13:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E64BD52D4E + for ; + Thu, 14 Jul 2005 03:12:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87897-07 + for ; + Thu, 14 Jul 2005 06:12:51 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id AE09652D47 + for ; + Thu, 14 Jul 2005 03:12:47 -0300 (ADT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1DswxS-0003ZU-00; Thu, 14 Jul 2005 02:12:30 -0400 +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: Quad Opteron stuck in the mud +References: +In-Reply-To: +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 14 Jul 2005 02:12:30 -0400 +Message-ID: <87oe95ykz5.fsf@stark.xeocode.com> +Lines: 57 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/163 +X-Sequence-Number: 13404 + +Dan Harris writes: + +> I keep the entire database vacuumed regularly. + +How often is "regularly"? We get frequent posts from people who think daily or +every 4 hours is often enough. If the table is very busy you can need vacuums +as often as every 15 minutes. + +Also, if you've done occasional massive batch updates like you describe here +you may need a VACUUM FULL or alternatively a CLUSTER command to compact the +table -- vacuum identifies the free space but if you've doubled the size of +your table with a large update that's a lot more free space than you want +hanging around waiting to be used. + +> For example, as I'm writing this, I am running an UPDATE statement that will +> affect a small part of the table, and is querying on an indexed boolean field. +... +> update eventactivity set ftindex = false where ftindex = true; ( added the +> where clause because I don't want to alter where ftindex is null ) + +It's definitely worthwhile doing an "EXPLAIN UPDATE..." to see if this even +used the index. It sounds like it did a sequential scan. + +Sequential scans during updates are especially painful. If there isn't free +space lying around in the page where the updated record lies then another page +has to be used or a new page added. If you're doing a massive update you can +exhaust the free space available making the update have to go back and forth +between the page being read and the end of the table where pages are being +written. + +> ##### +> +> vmstat output ( as I am waiting for this to finish ): +> procs -----------memory---------- ---swap-- -----io---- --system-- +> ----cpu---- +> r b swpd free buff cache si so bi bo in cs us sy id wa +> 0 1 5436 2823908 26140 9183704 0 1 2211 540 694 336 9 2 76 13 + +[I assume you ran "vmstat 10" or some other interval and then waited for at +least the second line? The first line outputted from vmstat is mostly +meaningless] + +Um. That's a pretty meager i/o rate. Just over 2MB/s. The cpu is 76% idle +which sounds fine but that could be one processor pegged at 100% while the +others are idle. If this query is the only one running on the system then it +would behave just like that. + +Is it possible you have some foreign keys referencing these records that +you're updating? In which case every record being updated might be causing a +full table scan on another table (or multiple other tables). If those tables +are entirely in cache then it could cause these high cpu low i/o symptoms. + +Or are there any triggers on this table? + + +-- +greg + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 03:27:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 876AC52D3B + for ; + Thu, 14 Jul 2005 03:27:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91341-04 + for ; + Thu, 14 Jul 2005 06:27:33 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) + by svr1.postgresql.org (Postfix) with ESMTP id 4FA6652C70 + for ; + Thu, 14 Jul 2005 03:27:32 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id j6E6RWv11806; + Thu, 14 Jul 2005 02:27:32 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200507140627.j6E6RWv11806@candle.pha.pa.us> +Subject: Re: Profiler for PostgreSQL +In-Reply-To: <8d1c715f05071322582a27b996@mail.gmail.com> +To: Agha Asif Raza +Date: Thu, 14 Jul 2005 02:27:32 -0400 (EDT) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/165 +X-Sequence-Number: 13406 + +Agha Asif Raza wrote: +> Is there any MS-SQL Server like 'Profiler' available for PostgreSQL? A +> profiler is a tool that monitors the database server and outputs a detailed +> trace of all the transactions/queries that are executed on a database during +> a specified period of time. Kindly let me know if any of you knows of such a +> tool for PostgreSQL. +> Agha Asif Raza + +Sure see log_statement in postgresql.conf. There are a lot of settings +in there to control what is logged. + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-performance-owner@postgresql.org Thu Jul 14 03:28:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3705452D10 + for ; + Thu, 14 Jul 2005 03:28:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91792-03 + for ; + Thu, 14 Jul 2005 06:28:09 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 9A77652D4C + for ; + Thu, 14 Jul 2005 03:28:08 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id 7F389644197 + for ; + Thu, 14 Jul 2005 00:27:45 -0600 (MDT) +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 01772-07 for ; + Thu, 14 Jul 2005 00:27:43 -0600 (MDT) +Received: from [192.168.1.100] (c-67-162-134-190.hsd1.co.comcast.net + [67.162.134.190]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id 8A9A6644195 + for ; + Thu, 14 Jul 2005 00:27:43 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +In-Reply-To: <87oe95ykz5.fsf@stark.xeocode.com> +References: + <87oe95ykz5.fsf@stark.xeocode.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +From: Dan Harris +Subject: Re: Quad Opteron stuck in the mud +Date: Thu, 14 Jul 2005 00:28:05 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/166 +X-Sequence-Number: 13407 + + +On Jul 14, 2005, at 12:12 AM, Greg Stark wrote: + +> Dan Harris writes: +> +> +>> I keep the entire database vacuumed regularly. +>> +> +> How often is "regularly"? +Well, once every day, but there aren't a ton of inserts or updates +going on a daily basis. Maybe 1,000 total inserts? +> +> Also, if you've done occasional massive batch updates like you +> describe here +> you may need a VACUUM FULL or alternatively a CLUSTER command to +> compact the +> table -- vacuum identifies the free space but if you've doubled the +> size of +> your table with a large update that's a lot more free space than +> you want +> hanging around waiting to be used. +> +I have a feeling I'm going to need to do a cluster soon. I have done +several mass deletes and reloads on it. + +> +>> For example, as I'm writing this, I am running an UPDATE +>> statement that will +>> affect a small part of the table, and is querying on an indexed +>> boolean field. +>> +> ... +> +>> update eventactivity set ftindex = false where ftindex = true; +>> ( added the +>> where clause because I don't want to alter where ftindex is null ) +>> +> +> It's definitely worthwhile doing an "EXPLAIN UPDATE..." to see if +> this even +> used the index. It sounds like it did a sequential scan. +> + +I tried that, and indeed it was using an index, although after +reading Simon's post, I realize that was kind of dumb to have an +index on a bool. I have since removed it. + +> Sequential scans during updates are especially painful. If there +> isn't free +> space lying around in the page where the updated record lies then +> another page +> has to be used or a new page added. If you're doing a massive +> update you can +> exhaust the free space available making the update have to go back +> and forth +> between the page being read and the end of the table where pages +> are being +> written. + +This is great info, thanks. + +> +> +>> ##### +>> +>> vmstat output ( as I am waiting for this to finish ): +>> procs -----------memory---------- ---swap-- -----io---- --system-- +>> ----cpu---- +>> r b swpd free buff cache si so bi bo in +>> cs us sy id wa +>> 0 1 5436 2823908 26140 9183704 0 1 2211 540 694 +>> 336 9 2 76 13 +>> +> +> [I assume you ran "vmstat 10" or some other interval and then +> waited for at +> least the second line? The first line outputted from vmstat is mostly +> meaningless] + +Yeah, this was at least 10 or so down the list ( the last one before +ctrl-c ) + +> +> Um. That's a pretty meager i/o rate. Just over 2MB/s. The cpu is +> 76% idle +> which sounds fine but that could be one processor pegged at 100% +> while the +> others are idle. If this query is the only one running on the +> system then it +> would behave just like that. +Well, none of my processors had ever reached 100% until I changed to +ext2 today ( read below for more info ) +> +> Is it possible you have some foreign keys referencing these records +> that +> you're updating? In which case every record being updated might be +> causing a +> full table scan on another table (or multiple other tables). If +> those tables +> are entirely in cache then it could cause these high cpu low i/o +> symptoms. +> + +No foreign keys or triggers. + + +Ok, so I remounted this drive as ext2 shortly before sending my first +email today. It wasn't enough time for me to notice the ABSOLUTELY +HUGE difference in performance change. Ext3 must really be crappy +for postgres, or at least is on this box. Now that it's ext2, this +thing is flying like never before. My CPU utilization has +skyrocketed, telling me that the disk IO was constraining it immensely. + +I always knew that it might be a little faster, but the box feels +like it can "breathe" again and things that used to be IO intensive +and run for an hour or more are now running in < 5 minutes. I'm a +little worried about not having a journalized file system, but that +performance difference will keep me from switching back ( at least to +ext3! ). Maybe someday I will try XFS. + +I would be surprised if everyone who ran ext3 had this kind of +problem, maybe it's specific to my kernel, raid controller, I don't +know. But, this is amazing. It's like I have a new server. + +Thanks to everyone for their valuable input and a big thanks to all +the dedicated pg developers on here who make this possible! + +-Dan + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 03:24:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F307D52D49 + for ; + Thu, 14 Jul 2005 03:24:41 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91092-04 + for ; + Thu, 14 Jul 2005 06:24:40 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 03BE452D46 + for ; + Thu, 14 Jul 2005 03:24:38 -0300 (ADT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 1A38A24FE0; + Thu, 14 Jul 2005 14:24:31 +0800 (WST) +Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 0118224FDD; + Thu, 14 Jul 2005 14:24:31 +0800 (WST) +Message-ID: <42D60664.90400@familyhealth.com.au> +Date: Thu, 14 Jul 2005 14:29:56 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Agha Asif Raza +Cc: pgsql-performance@postgresql.org +Subject: Re: Profiler for PostgreSQL +References: <8d1c715f05071322582a27b996@mail.gmail.com> +In-Reply-To: <8d1c715f05071322582a27b996@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/164 +X-Sequence-Number: 13405 + +Try turning on query logging and using the 'pqa' utility on pgfoundry.org. + +Chris + +Agha Asif Raza wrote: +> Is there any MS-SQL Server like 'Profiler' available for PostgreSQL? A +> profiler is a tool that monitors the database server and outputs a +> detailed trace of all the transactions/queries that are executed on a +> database during a specified period of time. Kindly let me know if any of +> you knows of such a tool for PostgreSQL. +> +> Agha Asif Raza + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 03:33:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 07AE052D3D + for ; + Thu, 14 Jul 2005 03:33:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 90271-08 + for ; + Thu, 14 Jul 2005 06:33:42 +0000 (GMT) +Received: from mail24.sea5.speakeasy.net (mail24.sea5.speakeasy.net + [69.17.117.26]) + by svr1.postgresql.org (Postfix) with ESMTP id 1555F52D4E + for ; + Thu, 14 Jul 2005 03:33:41 -0300 (ADT) +Received: (qmail 7549 invoked from network); 14 Jul 2005 06:33:42 -0000 +Received: from dsl081-060-184.sfo1.dsl.speakeasy.net (HELO noodles) + ([64.81.60.184]) (envelope-sender ) + by mail24.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP + for ; 14 Jul 2005 06:33:41 -0000 +Received: from jwb by noodles with local (Exim 3.36 #1 (Debian)) + id 1DsxHx-0001lg-00 + for ; Wed, 13 Jul 2005 23:33:41 -0700 +Subject: JFS fastest filesystem for PostgreSQL? +From: "Jeffrey W. Baker" +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Date: Wed, 13 Jul 2005 23:33:41 -0700 +Message-Id: <1121322821.6719.0.camel@noodles> +Mime-Version: 1.0 +X-Mailer: Evolution 2.3.4 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/167 +X-Sequence-Number: 13408 + +[reposted due to delivery error -jwb] + +I just took delivery of a new system, and used the opportunity to +benchmark postgresql 8.0 performance on various filesystems. The system +in question runs Linux 2.6.12, has one CPU and 1GB of system memory, and +5 7200RPM SATA disks attached to an Areca hardware RAID controller +having 128MB of cache. The caches are all write-back. + +I ran pgbench with a scale factor of 1000 and a total of 100,000 +transactions per run. I varied the number of clients between 10 and +100. It appears from my test JFS is much faster than both ext3 and XFS +for this workload. JFS and XFS were made with the mkfs defaults. ext3 +was made with -T largefile4 and -E stride=32. The deadline scheduler +was used for all runs (anticipatory scheduler is much worse). + +Here's the result, in transactions per second. + + ext3 jfs xfs +----------------------------- + 10 Clients 55 81 68 +100 Clients 61 100 64 +---------------------------- + +-jwb + +From pgsql-performance-owner@postgresql.org Fri Jul 15 02:08:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7E92A52CA2 + for ; + Thu, 14 Jul 2005 17:58:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94441-06 + for ; + Thu, 14 Jul 2005 20:58:09 +0000 (GMT) +Received: from hub.org (hub.org [200.46.204.220]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DB1352CA0 + for ; + Thu, 14 Jul 2005 17:58:09 -0300 (ADT) +Received: from localhost (unknown [200.46.204.144]) + by hub.org (Postfix) with ESMTP id 64975A24653 + for ; + Thu, 14 Jul 2005 17:58:08 -0300 (ADT) +Received: from hub.org ([200.46.204.220]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94466-08 for ; + Thu, 14 Jul 2005 20:57:59 +0000 (GMT) +Received: from ganymede.hub.org (blk-224-176-51.eastlink.ca [24.224.176.51]) + by hub.org (Postfix) with ESMTP id F02F0A246B6 + for ; + Thu, 14 Jul 2005 17:57:58 -0300 (ADT) +Received: by ganymede.hub.org (Postfix, from userid 1000) + id 402093DF45; Thu, 14 Jul 2005 17:58:04 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by ganymede.hub.org (Postfix) with ESMTP id 3CF683DF2F + for ; + Thu, 14 Jul 2005 17:58:04 -0300 (ADT) +X-Return-Path: +X-Received: from localhost ([unix socket]) + by ganymede.hub.org (Cyrus v2.2.12) with LMTPA; + Thu, 14 Jul 2005 03:35:49 -0300 +X-Sieve: CMU Sieve 2.2 +X-Received: from localhost (localhost [127.0.0.1]) + by ganymede.hub.org (Postfix) with ESMTP id F172945997 + for ; Thu, 14 Jul 2005 03:35:23 -0300 (ADT) +X-Received: from mail.postgresql.org [200.46.204.71] + by localhost with IMAP (fetchmail-6.2.5) + for scrappy@localhost (single-drop); + Thu, 14 Jul 2005 03:35:24 -0300 (ADT) +X-Received: from svr1.postgresql.org ([unix socket]) + by svr1.postgresql.org (Cyrus v2.2.12) with LMTPA; + Thu, 14 Jul 2005 03:34:03 -0300 +X-Sieve: CMU Sieve 2.2 +X-Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C130652D49 + for ; Thu, 14 Jul 2005 03:34:03 -0300 (ADT) +X-Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 90271-10 for ; + Thu, 14 Jul 2005 06:33:56 +0000 (GMT) +X-Received: from nextmail.ru (unknown [83.222.5.149]) + by svr1.postgresql.org (Postfix) with SMTP id CFE0552D10 + for ; + Thu, 14 Jul 2005 03:33:54 -0300 (ADT) +X-Received: (qmail 63581 invoked from network); 14 Jul 2005 06:32:47 -0000 +X-Received: from ppp85-140-125-114.pppoe.mtu-net.ru (HELO z) (85.140.125.114) + by nextmail.ru with SMTP; 14 Jul 2005 06:32:47 -0000 +From: "jobapply" +To: +Subject: Indexing Function called on VACUUM and sorting ? +Date: Thu, 14 Jul 2005 10:33:53 +0400 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Mailer: Microsoft Office Outlook, Build 11.0.6353 +Thread-Index: AcWIBRPH0sxvB4uyS7CMZ6QrhZOEzw== +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +Message-Id: <20050714063354.CFE0552D10@svr1.postgresql.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-DCC: : +X-Spam-Pyzor: Reported 0 times. +ReSent-Date: Thu, 14 Jul 2005 17:57:59 -0300 (ADT) +Resent-From: "Marc G. Fournier" +Resent-To: pgsql-performance@postgresql.org +ReSent-Subject: Indexing Function called on VACUUM and sorting ? +ReSent-Message-ID: <20050714175759.A66818@ganymede.hub.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.647 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/209 +X-Sequence-Number: 13450 + +It seems functional indexes are recalculated even where it is obviously not +needed. + +\d+ test: + + i | integer | | + t | text | | + x | text | | + "i_i" btree (i) + "x_iii" btree (xpath_string(x, 'movie/rating'::text)) + + +1) +When I run +VACUUM FULL ANALYZE VERBOSE +OR +VACUUM ANALYZE +a lot of xpath_string calls occur. +Does VACUUM rebuild indexes ? What for to recalculate that all? +It makes VACUUMing very slow. + +Simple VACUUM call does not lead to such function calls. + +2) +When I do +select * from test order by xpath_string(x, 'movie/rating'::text) limit 1000 +offset 10; + +Planner uses index x_iii (as it should, ok here): Limit -> Index scan. +But many of calls to xpath_string occur in execution time. +Why ? Index is calculated already and everything is so immutable.. + +Please answer if you have any ideas.. Functional indexes seemed so great +first, but now I uncover weird issues I can't understand.. + + + + + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 03:54:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7BC2C52C2B + for ; + Thu, 14 Jul 2005 03:54:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97294-07 + for ; + Thu, 14 Jul 2005 06:54:40 +0000 (GMT) +Received: from lakermmtao06.cox.net (lakermmtao06.cox.net [68.230.240.33]) + by svr1.postgresql.org (Postfix) with ESMTP id 4F0D152D10 + for ; + Thu, 14 Jul 2005 03:54:37 -0300 (ADT) +Received: from [127.0.0.1] (really [68.3.22.74]) by lakermmtao06.cox.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050714065435.PEON2772.lakermmtao06.cox.net@[127.0.0.1]>; + Thu, 14 Jul 2005 02:54:35 -0400 +Message-ID: <42D60C2E.3020004@works4me.com> +Date: Wed, 13 Jul 2005 23:54:38 -0700 +From: Dennis +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: David Mitchell +Cc: Qingqing Zhou , + pgsql-performance@postgresql.org +Subject: Re: performance problems ... 100 cpu utilization +References: <42D567DB.6000100@works4me.com> + <42D5DBEB.4010503@works4me.com> <42D5F315.3090301@telogis.com> +In-Reply-To: <42D5F315.3090301@telogis.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Antivirus: avast! (VPS 0528-3, 07/13/2005), Outbound message +X-Antivirus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/168 +X-Sequence-Number: 13409 + +David Mitchell wrote: + +> What is the load average on this machine? Do you do many updates? If +> you do a lot of updates, perhaps you haven't vacuumed recently. We +> were seeing similar symptoms when we started load testing our stuff +> and it turned out we were vacuuming too infrequently. + +The load average at the 100% utilization point was about 30! A vacuum +analyze was done before the test was started. I believe there are many +more selects than updates happening at any one time. + +Dennis + +From pgsql-performance-owner@postgresql.org Thu Jul 14 04:07:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C050A52C2B + for ; + Thu, 14 Jul 2005 04:07:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 00182-05 + for ; + Thu, 14 Jul 2005 07:06:58 +0000 (GMT) +Received: from mail.aveo.aveopharma.com (67.109.105.227.ptr.us.xo.net + [67.109.105.227]) + by svr1.postgresql.org (Postfix) with SMTP id A9FD3529FA + for ; + Thu, 14 Jul 2005 04:06:54 -0300 (ADT) +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: JFS fastest filesystem for PostgreSQL? +Date: Thu, 14 Jul 2005 03:08:41 -0400 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] JFS fastest filesystem for PostgreSQL? +Thread-Index: AcWIPqkoJ2ayb+NuQBS/NaTV7qnmNwAA7l1A +From: "Dmitri Bichko" +To: "Jeffrey W. Baker" , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/169 +X-Sequence-Number: 13410 + +I was wondering - have you had a chance to run the same benchmarks on +ReiserFS (ideally both 3 and 4, with notail)? + +I'd be quite interested to see how it performs in this situation since +it's my fs of choice for most things. + +Thanks, +Dmitri + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Jeffrey W. +Baker +Sent: Thursday, July 14, 2005 2:34 AM +To: pgsql-performance@postgresql.org +Subject: [PERFORM] JFS fastest filesystem for PostgreSQL? + + +[reposted due to delivery error -jwb] + +I just took delivery of a new system, and used the opportunity to +benchmark postgresql 8.0 performance on various filesystems. The system +in question runs Linux 2.6.12, has one CPU and 1GB of system memory, and +5 7200RPM SATA disks attached to an Areca hardware RAID controller +having 128MB of cache. The caches are all write-back. + +I ran pgbench with a scale factor of 1000 and a total of 100,000 +transactions per run. I varied the number of clients between 10 and +100. It appears from my test JFS is much faster than both ext3 and XFS +for this workload. JFS and XFS were made with the mkfs defaults. ext3 +was made with -T largefile4 and -E stride=3D32. The deadline scheduler +was used for all runs (anticipatory scheduler is much worse). + +Here's the result, in transactions per second. + + ext3 jfs xfs +----------------------------- + 10 Clients 55 81 68 +100 Clients 61 100 64 +---------------------------- + +-jwb + +---------------------------(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 +The information transmitted is intended only for the person or entity to = +which it is addressed and may contain confidential and/or privileged mate= +rial. Any review, retransmission, dissemination or other use of, or takin= +g of any action in reliance upon, this information by persons or entities= + other than the intended recipient is prohibited. If you received this in= + error, please contact the sender and delete the material from any comput= +er + +From pgsql-performance-owner@postgresql.org Fri Jul 15 02:06:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 40B1752C70 + for ; + Thu, 14 Jul 2005 04:19:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01513-09 + for ; + Thu, 14 Jul 2005 07:19:38 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id B734252C2B + for ; + Thu, 14 Jul 2005 04:19:35 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id D494430B43; Thu, 14 Jul 2005 09:24:39 +0200 (MET DST) +From: "Relaxin" +X-Newsgroups: pgsql.performance +Subject: PostgresSQL vs. Firebird +Date: Thu, 14 Jul 2005 00:19:34 -0700 +Organization: Hub.Org Networking Services +Lines: 23 +Message-ID: +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 +X-RFC2646: Format=Flowed; Original +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.185 tagged_above=0 required=5 tests=PRIORITY_NO_NAME +X-Spam-Level: * +X-Archive-Number: 200507/207 +X-Sequence-Number: 13448 + +Before I ask, I don't want to start a war. + +Can someone here give me an honest opinion of how PostgresSQL (PG) is better +than Firebird on Windows? + +I've just recently started reading the Firebird NG and a poster over there +has brought up some serious issues with Firebird, but they seem to not take +the issues seriously. + +I first wanted to go with Firebird for 2 reasons... + +Very easy to configure and very easy to install. +I assumed that the database worked ok, but I'm not so sure now. + +So, I've decided to give PG a try...I've downloaded it, but haven't +installed it yet. + +So any provable information that you can provide as to why/how PG is +better/faster/easier/reliable than Firebird would be greatly appreciated. + +Thanks + + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 05:03:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9834E52D3B + for ; + Thu, 14 Jul 2005 05:03:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11396-05 + for ; + Thu, 14 Jul 2005 08:03:12 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.204]) + by svr1.postgresql.org (Postfix) with ESMTP id E494B52C6B + for ; + Thu, 14 Jul 2005 05:03:09 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id z3so193403nzf + for ; + Thu, 14 Jul 2005 01:03:10 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=L4TVgV9rP8fiocoQAv/EPG6AsQr9pqx58I0FQrnJz0FPVcf5AYBNDQTtmTnPk47Z61DS0npX6JiTvgR9fZixyZ/XbBJIjZWqH3pr0MXklhybA5dLO7Myfh37cmPGT1+G+TXNkfuiL9nFoxS/tv3h8kUxjXCSKD7rtch6IYr0KYY= +Received: by 10.36.79.4 with SMTP id c4mr163872nzb; + Thu, 14 Jul 2005 01:03:10 -0700 (PDT) +Received: by 10.36.22.20 with HTTP; Thu, 14 Jul 2005 01:03:10 -0700 (PDT) +Message-ID: <758d5e7f05071401034665841c@mail.gmail.com> +Date: Thu, 14 Jul 2005 10:03:10 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: "Jeffrey W. Baker" +Subject: Re: JFS fastest filesystem for PostgreSQL? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1121322821.6719.0.camel@noodles> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <1121322821.6719.0.camel@noodles> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.615 tagged_above=0 required=5 tests=AWL, + FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/170 +X-Sequence-Number: 13411 + +On 7/14/05, Jeffrey W. Baker wrote: +> [reposted due to delivery error -jwb] +>=20 +> I just took delivery of a new system, and used the opportunity to +> benchmark postgresql 8.0 performance on various filesystems. The system +> in question runs Linux 2.6.12, has one CPU and 1GB of system memory, and +> 5 7200RPM SATA disks attached to an Areca hardware RAID controller +> having 128MB of cache. The caches are all write-back. +>=20 +> I ran pgbench with a scale factor of 1000 and a total of 100,000 +> transactions per run. I varied the number of clients between 10 and +> 100. It appears from my test JFS is much faster than both ext3 and XFS +> for this workload. JFS and XFS were made with the mkfs defaults. ext3 +> was made with -T largefile4 and -E stride=3D32. The deadline scheduler +> was used for all runs (anticipatory scheduler is much worse). +>=20 +> Here's the result, in transactions per second. +>=20 +> ext3 jfs xfs +> ----------------------------- +> 10 Clients 55 81 68 +> 100 Clients 61 100 64 +> ---------------------------- + +If you still have a chance, could you do tests with other journaling +options for ext3 (journal=3Dwriteback, journal=3Ddata)? And could you +give figures about performace of other IO elevators? I mean, you +wrote that anticipatory is much wore -- how much worse? :) Could +you give numbers for deadline,anticipatory,cfq elevators? :) + +And, additionally would it be possible to give numbers for bonnie++ +results? To see how does pgbench to bonnie++ relate? + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Thu Jul 14 05:05:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8844752D52 + for ; + Thu, 14 Jul 2005 05:05:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11817-09 + for ; + Thu, 14 Jul 2005 08:05:25 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 60C7552D56 + for ; + Thu, 14 Jul 2005 05:05:24 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id 39EE5644195 + for ; + Thu, 14 Jul 2005 02:05:03 -0600 (MDT) +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 02754-01 for ; + Thu, 14 Jul 2005 02:05:01 -0600 (MDT) +Received: from [192.168.1.100] (c-67-162-134-190.hsd1.co.comcast.net + [67.162.134.190]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id 00A57644191 + for ; + Thu, 14 Jul 2005 02:05:00 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +Content-Transfer-Encoding: 7bit +Message-Id: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +To: pgsql-performance@postgresql.org +From: Dan Harris +Subject: slow joining very large table to smaller ones +Date: Thu, 14 Jul 2005 02:05:23 -0600 +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/171 +X-Sequence-Number: 13412 + +I'm trying to improve the speed of this query: + +explain select recordtext from eventactivity inner join ( select +incidentid from k_r where id = 94 ) a using ( incidentid ) inner join +( select incidentid from k_b where id = 107 ) b using ( incidentid ); + QUERY PLAN +------------------------------------------------------------------------ +-------------------------------------- +Merge Join (cost=2747.29..4249364.96 rows=11968693 width=35) + Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") + -> Merge Join (cost=1349.56..4230052.73 rows=4413563 width=117) + Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") + -> Index Scan using eventactivity1 on eventactivity +(cost=0.00..4051200.28 rows=44519781 width=49) + -> Sort (cost=1349.56..1350.85 rows=517 width=68) + Sort Key: (k_b.incidentid)::text + -> Index Scan using k_b_idx on k_b +(cost=0.00..1326.26 rows=517 width=68) + Index Cond: (id = 107) + -> Sort (cost=1397.73..1399.09 rows=542 width=68) + Sort Key: (k_r.incidentid)::text + -> Index Scan using k_r_idx on k_r (cost=0.00..1373.12 +rows=542 width=68) + Index Cond: (id = 94) +(13 rows) + + +There are many millions of rows in eventactivity. There are a few +ten-thousand rows in k_r and k_b. There is an index on 'incidentid' +in all three tables. There should only be less than 100 rows matched +in k_r and k_b total. That part on its own is very very fast. But, +it should have those 100 or so incidentids extracted in under a +second and then go into eventactivity AFTER doing that. At least, +that's my intention to make this fast. + +Right now, it looks like pg is trying to sort the entire +eventactivity table for the merge join which is taking several +minutes to do. Can I rephrase this so that it does the searching +through k_r and k_b FIRST and then go into eventactivity using the +index on incidentid? It seems like that shouldn't be too hard to +make fast but my SQL query skills are only average. + +Thanks +-Dan + +From pgsql-performance-owner@postgresql.org Thu Jul 14 06:56:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7F0EC52C28 + for ; + Thu, 14 Jul 2005 06:56:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36973-10 + for ; + Thu, 14 Jul 2005 09:56:36 +0000 (GMT) +Received: from mail0.rawbw.com (mail0.rawbw.com [198.144.192.41]) + by svr1.postgresql.org (Postfix) with ESMTP id 90C2E52C16 + for ; + Thu, 14 Jul 2005 06:56:31 -0300 (ADT) +Received: (from www@localhost) + by mail0.rawbw.com (8.11.6p2/8.11.6) id j6E9uXF61147 + for pgsql-performance@postgresql.org; + Thu, 14 Jul 2005 02:56:33 -0700 (PDT) +Received: from 198.144.203.173 ([198.144.203.173]) + by webmail.rawbw.com (IMP) with HTTP + for ; Thu, 14 Jul 2005 02:56:33 -0700 +Message-ID: <1121334993.42d636d187a3b@webmail.rawbw.com> +Date: Thu, 14 Jul 2005 02:56:33 -0700 +From: mudfoot@rawbw.com +To: pgsql-performance@postgresql.org +Subject: Re: JFS fastest filesystem for PostgreSQL? +References: <1121322821.6719.0.camel@noodles> +In-Reply-To: <1121322821.6719.0.camel@noodles> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.2.1 +X-Originating-IP: 198.144.203.173 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=AWL, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200507/172 +X-Sequence-Number: 13413 + + + +Quoting "Jeffrey W. Baker" : + + +> +> Here's the result, in transactions per second. +> +> ext3 jfs xfs +> ---------------------- + +------- +> 10 Clients 55 81 68 +> 100 Clients 61 100 64 +> ---------------------------- + +Was fsync true? And have you tried ext2? Legend has it that ext2 is the +fastest thing going for synchronous writes (besides O_DIRECT or raw) because +there's no journal. + +> +> -jwb +> +> ---------------------------(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 Jul 14 07:30:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4FF1F5294D + for ; + Thu, 14 Jul 2005 07:30:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45814-04 + for ; + Thu, 14 Jul 2005 10:30:45 +0000 (GMT) +Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 1C0A35280C + for ; + Thu, 14 Jul 2005 07:30:42 -0300 (ADT) +Received: from osgiliath.mathom.us ([70.108.75.132]) + by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IJM0066N5770OC0@vms040.mailsrvcs.net> for + pgsql-performance@postgresql.org; Thu, 14 Jul 2005 05:30:44 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id 99CE76005EA for + ; + Thu, 14 Jul 2005 06:30:42 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 10654-01-20 for ; Thu, + 14 Jul 2005 06:30:41 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id 067B9600197; Thu, 14 Jul 2005 06:30:41 -0400 (EDT) +Date: Thu, 14 Jul 2005 06:30:40 -0400 +From: Michael Stone +Subject: Re: JFS fastest filesystem for PostgreSQL? +In-reply-to: <1121322821.6719.0.camel@noodles> +To: pgsql-performance@postgresql.org +Mail-Followup-To: pgsql-performance@postgresql.org +Message-id: <20050714103040.GR19080@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us +References: <1121322821.6719.0.camel@noodles> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/173 +X-Sequence-Number: 13414 + +Did you seperate the data & the transaction log? I've noticed less than +optimal performance on xfs if the transaction log is on the xfs data +partition, and it's silly to put the xlog on a journaled filesystem +anyway. Try putting xlog on an ext2 for all the tests. + +Mike Stone + +From pgsql-performance-owner@postgresql.org Thu Jul 14 08:20:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 29F9452C34 + for ; + Thu, 14 Jul 2005 08:20:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58844-06 + for ; + Thu, 14 Jul 2005 11:20:53 +0000 (GMT) +Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) + by svr1.postgresql.org (Postfix) with ESMTP id 659A952A42 + for ; + Thu, 14 Jul 2005 08:20:49 -0300 (ADT) +Received: from adsl7-104-140.du.simnet.is ([85.220.100.140] [85.220.100.140]) + by quasar.skima.is with ESMTP; Thu, 14 Jul 2005 11:20:26 Z +Subject: Re: Slow Query +From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= +To: Marc McIntyre +Cc: pgsql-performance@postgresql.org +In-Reply-To: <42D5AC8A.9000003@squiz.net> +References: <42D5AC8A.9000003@squiz.net> +Content-Type: text/plain +Date: Thu, 14 Jul 2005 11:22:33 +0000 +Message-Id: <1121340153.31360.22.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/174 +X-Sequence-Number: 13415 + +On Thu, 2005-07-14 at 10:06 +1000, Marc McIntyre wrote: + +> I'm having a problem with a query that performs a sequential scan on a +> table when it should be performing an index scan. The interesting thing +> is, when we dumped the database on another server, it performed an index +> scan on that server. +... +> The EXPLAIN ANALYZE from the system performing an sequential scan: +> +> QUERY PLAN +> Sort (cost=30079.79..30079.89 rows=42 width=113) (actual time=39889.989..39890.346 rows=260 loops=1) +... +> The EXPLAIN ANALYZE from the system performing an index scan scan: +> Sort (cost=16873.64..16873.74 rows=40 width=113) (actual time=2169.905..2169.912 rows=13 loops=1) + +looks like the first query is returning 260 rows, +but the second one 13 + +this may not be your problem, but are you sure you are using the same +query on the same data here ? + +gnari + + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 09:18:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4F5DA52C5C + for ; + Thu, 14 Jul 2005 09:18:55 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75524-02 + for ; + Thu, 14 Jul 2005 12:18:49 +0000 (GMT) +Received: from p0f.net (p0f.net [193.77.154.190]) + by svr1.postgresql.org (Postfix) with ESMTP id ACBF652C46 + for ; + Thu, 14 Jul 2005 09:18:47 -0300 (ADT) +Received: from [10.10.105.30] ([193.77.165.58]) (authenticated bits=0) + by p0f.net (8.13.3/8.13.3) with ESMTP id j6EC7Uo8014077 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); + Thu, 14 Jul 2005 14:07:32 +0200 +Message-ID: <42D65778.7010500@p0f.net> +Date: Thu, 14 Jul 2005 14:15:52 +0200 +From: Grega Bremec +Organization: P0F +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dawid Kuroczko +Cc: "Jeffrey W. Baker" , + pgsql-performance@postgresql.org +Subject: Re: JFS fastest filesystem for PostgreSQL? +References: <1121322821.6719.0.camel@noodles> + <758d5e7f05071401034665841c@mail.gmail.com> +In-Reply-To: <758d5e7f05071401034665841c@mail.gmail.com> +X-Enigmail-Version: 0.91.0.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.429 tagged_above=0 required=5 tests=AWL, + RCVD_IN_NJABL_DUL +X-Spam-Level: * +X-Archive-Number: 200507/175 +X-Sequence-Number: 13416 + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +Dawid Kuroczko wrote: +| +| If you still have a chance, could you do tests with other journaling +| options for ext3 (journal=writeback, journal=data)? And could you +| give figures about performace of other IO elevators? I mean, you +| wrote that anticipatory is much wore -- how much worse? :) Could +| you give numbers for deadline,anticipatory,cfq elevators? :) +| +| And, additionally would it be possible to give numbers for bonnie++ +| results? To see how does pgbench to bonnie++ relate? +| + +Hello, list. + +I've been thinking on this one for a while - I'm not sure as to what +ratio pgbench has with regard to stressing CPU vs. I/O. There is one +thing that's definitely worth mentioning though: in the tests that I've +been doing with bonnie++ and iozone at my former job, while building a +distributed indexing engine, jfs was the one filesystem with the least +strain on the CPU, which might be one of the deciding factors in making +it look good for a particular workload. + +I'm afraid I don't have any concrete figures to offer as the material +itself was classified. I can tell though that we've been comparing it +with both ext2 and ext3, as well as xfs, and notably, xfs was the worst +CPU hog of all. The CPU load difference between jfs and xfs was about +10% in favor of jfs in all random read/write tests, and the interesting +thing is, jfs managed to shuffle around quite a lot of data: the +mbps/cpu% ratio in xfs was much worse. As expected, there wasn't much +difference in block transfer tests, but jfs was slightly winning in the +area of CPU consumption and slightly lagging in the transfer rate field. + +What is a little bit concerning though, is the fact that some Linux +distributors like SuSE have removed jfs support from their admin tooling +due to technical problems with jfs +(http://your-local-suse-mirror/.../suse/i386/9.3/docu/RELEASE-NOTES.en.html#14) + +I'm curious as to what this means - did they have problems integrating +it into their toolchain or are there actual problems going on in jfs +currently? + +Kind regards, +- -- +Grega Bremec +gregab at p0f dot net +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iD8DBQFC1ld4fu4IwuB3+XoRAqEyAJ0TS9son+brhbQGtV7Cw7T8wa9W2gCfZ02/ +dWm/E/Dc99TyKbxxl2tKaZc= +=nvv3 +-----END PGP SIGNATURE----- + +From pgsql-performance-owner@postgresql.org Thu Jul 14 10:21:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B1B5A52D31 + for ; + Thu, 14 Jul 2005 10:21:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 86615-08 + for ; + Thu, 14 Jul 2005 13:20:56 +0000 (GMT) +Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) + by svr1.postgresql.org (Postfix) with ESMTP id DB9C352C34 + for ; + Thu, 14 Jul 2005 10:20:54 -0300 (ADT) +Received: from osgiliath.mathom.us ([70.108.75.132]) + by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IJM005XOD2X5Z60@vms046.mailsrvcs.net> for + pgsql-performance@postgresql.org; Thu, 14 Jul 2005 08:20:58 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id CB79F6005EA for + ; + Thu, 14 Jul 2005 09:20:56 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 14200-01-6 for ; Thu, + 14 Jul 2005 09:20:56 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id B2E91600197; Thu, 14 Jul 2005 09:20:56 -0400 (EDT) +Date: Thu, 14 Jul 2005 09:20:56 -0400 +From: Michael Stone +Subject: Re: JFS fastest filesystem for PostgreSQL? +In-reply-to: <42D65778.7010500@p0f.net> +To: pgsql-performance@postgresql.org +Mail-Followup-To: pgsql-performance@postgresql.org +Message-id: <20050714132056.GU19080@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us +References: <1121322821.6719.0.camel@noodles> + <758d5e7f05071401034665841c@mail.gmail.com> <42D65778.7010500@p0f.net> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/176 +X-Sequence-Number: 13417 + +On Thu, Jul 14, 2005 at 02:15:52PM +0200, Grega Bremec wrote: +>I'm curious as to what this means - did they have problems integrating +>it into their toolchain or are there actual problems going on in jfs +>currently? + +I've found jfs to be the least stable linux filesystem and won't allow +it anywhere near an important system. YMMV. + +Mike Stone + +From pgsql-performance-owner@postgresql.org Thu Jul 14 10:27:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B6E0152B9E + for ; + Thu, 14 Jul 2005 10:27:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87068-09 + for ; + Thu, 14 Jul 2005 13:27:20 +0000 (GMT) +Received: from mail23.sea5.speakeasy.net (mail23.sea5.speakeasy.net + [69.17.117.25]) + by svr1.postgresql.org (Postfix) with ESMTP id 7B869528C6 + for ; + Thu, 14 Jul 2005 10:27:19 -0300 (ADT) +Received: (qmail 4086 invoked from network); 14 Jul 2005 13:27:22 -0000 +Received: from dsl081-060-184.sfo1.dsl.speakeasy.net (HELO noodles) + ([64.81.60.184]) (envelope-sender ) + by mail23.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP + for ; 14 Jul 2005 13:27:22 -0000 +Received: from jwb by noodles with local (Exim 3.36 #1 (Debian)) + id 1Dt3kK-0002HH-00; Thu, 14 Jul 2005 06:27:24 -0700 +Subject: Re: JFS fastest filesystem for PostgreSQL? +From: "Jeffrey W. Baker" +To: Dawid Kuroczko +Cc: pgsql-performance@postgresql.org +In-Reply-To: <758d5e7f05071401034665841c@mail.gmail.com> +References: <1121322821.6719.0.camel@noodles> + <758d5e7f05071401034665841c@mail.gmail.com> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Date: Thu, 14 Jul 2005 06:27:24 -0700 +Message-Id: <1121347644.8468.3.camel@noodles> +Mime-Version: 1.0 +X-Mailer: Evolution 2.3.4 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/177 +X-Sequence-Number: 13418 + +On Thu, 2005-07-14 at 10:03 +0200, Dawid Kuroczko wrote: +> On 7/14/05, Jeffrey W. Baker wrote: +> > [reposted due to delivery error -jwb] +> > +> > I just took delivery of a new system, and used the opportunity to +> > benchmark postgresql 8.0 performance on various filesystems. The system +> > in question runs Linux 2.6.12, has one CPU and 1GB of system memory, and +> > 5 7200RPM SATA disks attached to an Areca hardware RAID controller +> > having 128MB of cache. The caches are all write-back. +> > +> > I ran pgbench with a scale factor of 1000 and a total of 100,000 +> > transactions per run. I varied the number of clients between 10 and +> > 100. It appears from my test JFS is much faster than both ext3 and XFS +> > for this workload. JFS and XFS were made with the mkfs defaults. ext3 +> > was made with -T largefile4 and -E stride=32. The deadline scheduler +> > was used for all runs (anticipatory scheduler is much worse). +> > +> > Here's the result, in transactions per second. +> > +> > ext3 jfs xfs +> > ----------------------------- +> > 10 Clients 55 81 68 +> > 100 Clients 61 100 64 +> > ---------------------------- +> +> If you still have a chance, could you do tests with other journaling +> options for ext3 (journal=writeback, journal=data)? And could you +> give figures about performace of other IO elevators? I mean, you +> wrote that anticipatory is much wore -- how much worse? :) Could +> you give numbers for deadline,anticipatory,cfq elevators? :) +> +> And, additionally would it be possible to give numbers for bonnie++ +> results? To see how does pgbench to bonnie++ relate? + +Phew, that's a lot of permutations. At 20-30 minutes per run, I'm +thinking 5-8 hours or so. Still, for you dear readers, I'll somehow +accomplish this tedious feat. + +As for Bonnie, JFS is a good 60-80% faster than ext3. See my message to +ext3-users yesterday. + +Using bonnie++ with a 10GB fileset, in MB/s: + + ext3 jfs xfs +Read 112 188 141 +Write 97 157 167 +Rewrite 51 71 60 + +-jwb + +From pgsql-performance-owner@postgresql.org Thu Jul 14 12:43:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6C21652A1E + for ; + Thu, 14 Jul 2005 12:42:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22317-02 + for ; + Thu, 14 Jul 2005 15:42:47 +0000 (GMT) +Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) + by svr1.postgresql.org (Postfix) with ESMTP id 91D7952D86 + for ; + Thu, 14 Jul 2005 12:42:46 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP + id <20050714154245m9100k7u6ee>; Thu, 14 Jul 2005 15:42:45 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 842E555FFA; Thu, 14 Jul 2005 10:42:44 -0500 (CDT) +Received: from [192.168.1.120] (65-100-20-12.cdrr.qwest.net [65.100.20.12]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 4AA0055F99; + Thu, 14 Jul 2005 10:42:35 -0500 (CDT) +Message-ID: <42D687E5.7080202@arbash-meinel.com> +Date: Thu, 14 Jul 2005 10:42:29 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: slow joining very large table to smaller ones +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> +In-Reply-To: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigC9B6C8B1D8700835E847F8BE" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/178 +X-Sequence-Number: 13419 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigC9B6C8B1D8700835E847F8BE +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Dan Harris wrote: +> I'm trying to improve the speed of this query: +> +> explain select recordtext from eventactivity inner join ( select +> incidentid from k_r where id = 94 ) a using ( incidentid ) inner join ( +> select incidentid from k_b where id = 107 ) b using ( incidentid ); + +You might try giving it a little bit more freedom with: + +EXPLAIN ANALYZE +SELECT recordtext FROM eventactivity, k_r, k_b + WHERE eventactivity.incidentid = k_r.incidentid + AND eventactivity.incidentid = k_b.incidentid + AND k_r.id = 94 + AND k_b.id = 107 +-- AND k_r.incidentid = k_b.incidentid +; + +I'm pretty sure that would give identical results, just let the planner +have a little bit more freedom about how it does it. +Also the last line is commented out, because I think it is redundant. + +You might also try: +EXPLAIN ANALYZE +SELECT recordtext + FROM eventactivity JOIN k_r USING (incidentid) + JOIN k_b USING (incidentid) + WHERE k_r.id = 94 + AND k_b.id = 107 +; + +Also, if possible give us the EXPLAIN ANALYZE so that we know if the +planner is making accurate estimates. (You might send an EXPLAIN while +waiting for the EXPLAIN ANALYZE to finish) + +You can also try disabling merge joins, and see how that changes things. + +> QUERY PLAN +> ------------------------------------------------------------------------ +> -------------------------------------- +> Merge Join (cost=2747.29..4249364.96 rows=11968693 width=35) +> Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") +> -> Merge Join (cost=1349.56..4230052.73 rows=4413563 width=117) +> Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") +> -> Index Scan using eventactivity1 on eventactivity +> (cost=0.00..4051200.28 rows=44519781 width=49) +> -> Sort (cost=1349.56..1350.85 rows=517 width=68) +> Sort Key: (k_b.incidentid)::text +> -> Index Scan using k_b_idx on k_b (cost=0.00..1326.26 +> rows=517 width=68) +> Index Cond: (id = 107) +> -> Sort (cost=1397.73..1399.09 rows=542 width=68) +> Sort Key: (k_r.incidentid)::text +> -> Index Scan using k_r_idx on k_r (cost=0.00..1373.12 +> rows=542 width=68) +> Index Cond: (id = 94) +> (13 rows) +> +> +> There are many millions of rows in eventactivity. There are a few +> ten-thousand rows in k_r and k_b. There is an index on 'incidentid' in +> all three tables. There should only be less than 100 rows matched in +> k_r and k_b total. That part on its own is very very fast. But, it +> should have those 100 or so incidentids extracted in under a second and +> then go into eventactivity AFTER doing that. At least, that's my +> intention to make this fast. + +Well, postgres is estimating around 500 rows each, is that way off? Try +just doing: +EXPLAIN ANALYZE SELECT incidentid FROM k_b WHERE id = 107; +EXPLAIN ANALYZE SELECT incidentid FROM k_r WHERE id = 94; + +And see if postgres estimates the number of rows properly. + +I assume you have recently VACUUM ANALYZEd, which means you might need +to update the statistics target (ALTER TABLE k_b ALTER COLUMN +incidientid SET STATISTICS 100) default is IIRC 10, ranges from 1-1000, +higher is more accurate, but makes ANALYZE slower. + +> +> Right now, it looks like pg is trying to sort the entire eventactivity +> table for the merge join which is taking several minutes to do. Can I +> rephrase this so that it does the searching through k_r and k_b FIRST +> and then go into eventactivity using the index on incidentid? It seems +> like that shouldn't be too hard to make fast but my SQL query skills +> are only average. + +To me, it looks like it is doing an index scan (on k_b.id) through k_b +first, sorting the results by incidentid, then merge joining that with +eventactivity. + +I'm guessing you actually want it to merge k_b and k_r to get extra +selectivity before joining against eventactivity. +I think my alternate forms would let postgres realize this. But if not, +you could try: + +EXPLAIN ANALYZE +SELECT recordtext FROM eventactivity + JOIN (SELECT incidentid FROM k_r JOIN k_b USING (incidentid) + WHERE k_r.id = 94 AND k_b.id = 107) +USING (incidentid); + +I don't know how selective your keys are, but one of these queries +should probably structure it better for the planner. It depends a lot on +how selective your query is. +If you have 100M rows, the above query looks like it expects k_r to +restrict it to 44M rows, and k_r + k_b down to 11M rows, which really +should be a seq scan (> 10% of the rows = seq scan). But if you are +saying the selectivity is mis-estimated it could be different. + +John +=:-> +> +> Thanks +> -Dan +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + + +--------------enigC9B6C8B1D8700835E847F8BE +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC1ofoJdeBCYSNAAMRAvVVAKCwf0mWSGyfFRaY831W30LLDy0aNQCffkjr +F3km+Kw4JmYlf8leYWOdya0= +=JmgF +-----END PGP SIGNATURE----- + +--------------enigC9B6C8B1D8700835E847F8BE-- + +From pgsql-performance-owner@postgresql.org Thu Jul 14 12:47:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 23F7552D86 + for ; + Thu, 14 Jul 2005 12:47:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22829-04 + for ; + Thu, 14 Jul 2005 15:47:47 +0000 (GMT) +Received: from mr1.surnet.cl (smtp1.surnet.cl [216.155.73.162]) + by svr1.postgresql.org (Postfix) with ESMTP id 57CD452A1A + for ; + Thu, 14 Jul 2005 12:47:46 -0300 (ADT) +Received: from smtp1.surnet.cl (216.155.73.168) by mr1.surnet.cl (7.0.031.3) + id 42587EDE01566457; Thu, 14 Jul 2005 11:47:07 -0400 +Received: from smtp1.surnet.cl (mr1.surnet.cl []) + by mr1.surnet.cl ([216.155.73.168]); Thu, 14 Jul 2005 15:47:07 +0000 +Received: from cluster.surnet.cl (216.155.73.164) by smtp1.surnet.cl + (7.0.031.3) id 42587C6E01070D56; Thu, 14 Jul 2005 11:47:07 -0400 +Received: from alvh.no-ip.org (200.85.218.66) by cluster.surnet.cl (7.0.043) + (authenticated as alvherre@surnet.cl) + id 42B3EF60003B9223; Thu, 14 Jul 2005 11:47:44 -0400 +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id 42D15C370EE; Thu, 14 Jul 2005 11:47:51 -0400 (CLT) +Date: Thu, 14 Jul 2005 11:47:51 -0400 +From: Alvaro Herrera +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: Quad Opteron stuck in the mud +Message-ID: <20050714154750.GC19232@alvh.no-ip.org> +References: + <87oe95ykz5.fsf@stark.xeocode.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.377 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, RCVD_IN_NJABL_PROXY +X-Spam-Level: * +X-Archive-Number: 200507/179 +X-Sequence-Number: 13420 + +On Thu, Jul 14, 2005 at 12:28:05AM -0600, Dan Harris wrote: + +> Ok, so I remounted this drive as ext2 shortly before sending my first +> email today. It wasn't enough time for me to notice the ABSOLUTELY +> HUGE difference in performance change. Ext3 must really be crappy +> for postgres, or at least is on this box. Now that it's ext2, this +> thing is flying like never before. My CPU utilization has +> skyrocketed, telling me that the disk IO was constraining it immensely. + +Were you using the default journal settings for ext3? + +An interesting experiment would be to use the other journal options +(particularly data=writeback). From the mount manpage: + + data=journal / data=ordered / data=writeback + Specifies the journalling mode for file data. Metadata is + always journaled. To use modes other than ordered on the root + file system, pass the mode to the kernel as boot parameter, e.g. + rootflags=data=journal. + + journal + All data is committed into the journal prior to being + written into the main file system. + + ordered + This is the default mode. All data is forced directly + out to the main file system prior to its metadata being + committed to the journal. + + writeback + Data ordering is not preserved - data may be written into + the main file system after its metadata has been commit- + ted to the journal. This is rumoured to be the highest- + throughput option. It guarantees internal file system + integrity, however it can allow old data to appear in + files after a crash and journal recovery. + + +-- +Alvaro Herrera () +Officer Krupke, what are we to do? +Gee, officer Krupke, Krup you! (West Side Story, "Gee, Officer Krupke") + +From pgsql-performance-owner@postgresql.org Thu Jul 14 13:06:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 26E8352D49 + for ; + Thu, 14 Jul 2005 13:06:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25770-06 + for ; + Thu, 14 Jul 2005 16:06:00 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 2E9C252C2E + for ; + Thu, 14 Jul 2005 13:05:56 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id 448D7644196 + for ; + Thu, 14 Jul 2005 10:05:32 -0600 (MDT) +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 07169-06 for ; + Thu, 14 Jul 2005 10:05:29 -0600 (MDT) +Received: from [192.168.1.100] (c-67-162-134-190.hsd1.co.comcast.net + [67.162.134.190]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id 9D08A64419F + for ; + Thu, 14 Jul 2005 10:05:29 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +In-Reply-To: <20050714154750.GC19232@alvh.no-ip.org> +References: + <87oe95ykz5.fsf@stark.xeocode.com> + + <20050714154750.GC19232@alvh.no-ip.org> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +From: Dan Harris +Subject: Re: Quad Opteron stuck in the mud +Date: Thu, 14 Jul 2005 10:05:52 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/180 +X-Sequence-Number: 13421 + + +On Jul 14, 2005, at 9:47 AM, Alvaro Herrera wrote: + +> On Thu, Jul 14, 2005 at 12:28:05AM -0600, Dan Harris wrote: +> +>> . Ext3 must really be crappy +>> for postgres, or at least is on this box. +> +> Were you using the default journal settings for ext3? + +Yes, I was. Next time I get a chance to reboot this box, I will try +writeback and compare the benchmarks to my previous config. Thanks +for the tip. + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 13:26:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DB88452D94 + for ; + Thu, 14 Jul 2005 13:21:17 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 29436-05 + for ; + Thu, 14 Jul 2005 16:21:12 +0000 (GMT) +Received: from mr1.surnet.cl (smtp1.surnet.cl [216.155.73.162]) + by svr1.postgresql.org (Postfix) with ESMTP id AC37A52D56 + for ; + Thu, 14 Jul 2005 13:21:11 -0300 (ADT) +Received: from smtp1.surnet.cl (216.155.73.168) by mr1.surnet.cl (7.0.031.3) + id 42587EDE015680B1; Thu, 14 Jul 2005 12:20:30 -0400 +Received: from smtp2.surnet.cl (smtp2.surnet.cl []) + by mr1.surnet.cl ([216.155.73.168]); Thu, 14 Jul 2005 16:20:30 +0000 +Received: from cluster.surnet.cl (216.155.73.164) by smtp2.surnet.cl + (7.0.031.3) id 4259ADE300D1F941; Thu, 14 Jul 2005 12:20:50 -0400 +Received: from alvh.no-ip.org (200.85.218.66) by cluster.surnet.cl (7.0.043) + (authenticated as alvherre@surnet.cl) + id 42B3EF60003BA895; Thu, 14 Jul 2005 12:21:06 -0400 +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id B2F58C370EE; Thu, 14 Jul 2005 12:21:14 -0400 (CLT) +Date: Thu, 14 Jul 2005 12:21:14 -0400 +From: Alvaro Herrera +To: Alison Winters +Cc: pgsql-performance@postgresql.org +Subject: Re: lots of updates on small table +Message-ID: <20050714162114.GA19778@alvh.no-ip.org> +References: <42D5F34E.nail9QE1195IE@pluto.mirrabooka.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42D5F34E.nail9QE1195IE@pluto.mirrabooka.com> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.378 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, RCVD_IN_NJABL_PROXY +X-Spam-Level: * +X-Archive-Number: 200507/181 +X-Sequence-Number: 13422 + +On Thu, Jul 14, 2005 at 03:08:30PM +1000, Alison Winters wrote: +> Hi, +> +> Our application requires a number of processes to select and update rows +> from a very small (<10 rows) Postgres table on a regular and frequent +> basis. These processes often run for weeks at a time, but over the +> space of a few days we find that updates start getting painfully slow. +> We are running a full vacuum/analyze and reindex on the table every day, + +Full vacuum, eh? I wonder if what you really need is very frequent +non-full vacuum. Say, once in 15 minutes (exact rate depending on dead +tuple rate.) + +-- +Alvaro Herrera () +"World domination is proceeding according to plan" (Andrew Morton) + +From pgsql-performance-owner@postgresql.org Thu Jul 14 13:41:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 92A9752B5B + for ; + Thu, 14 Jul 2005 13:41:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34498-06 + for ; + Thu, 14 Jul 2005 16:41:37 +0000 (GMT) +Received: from twiddle.look.ca (beta1.look.ca [207.136.80.125]) + by svr1.postgresql.org (Postfix) with ESMTP id 9609452AA1 + for ; + Thu, 14 Jul 2005 13:41:36 -0300 (ADT) +Received: from 209-161-193-204.dsl.look.ca ([209.161.193.204]) + by twiddle.look.ca with esmtp (Exim 4.20) + id 1Dt6mE-0000fS-RR; Thu, 14 Jul 2005 16:41:34 +0000 +From: Rod Taylor +To: Alison Winters +Cc: pgsql-performance@postgresql.org +In-Reply-To: <42D5F34E.nail9QE1195IE@pluto.mirrabooka.com> +References: <42D5F34E.nail9QE1195IE@pluto.mirrabooka.com> +Date: Thu, 14 Jul 2005 12:37:42 -0400 +Message-Id: <1121359062.780.31.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.3 FreeBSD GNOME Team Port +X-SA-Exim-Mail-From: pg@rbt.ca +Subject: Re: lots of updates on small table +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +X-SA-Exim-Version: 3.1 (built Tue Feb 24 05:09:27 GMT 2004) +X-SA-Exim-Scanned: Yes +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.041 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/182 +X-Sequence-Number: 13423 + +On Thu, 2005-07-14 at 15:08 +1000, Alison Winters wrote: +> Hi, +> +> Our application requires a number of processes to select and update rows +> from a very small (<10 rows) Postgres table on a regular and frequent +> basis. These processes often run for weeks at a time, but over the + +Are these long running transactions or is the process issuing many short +transactions? + +If your transaction lasts a week, then a daily vacuum isn't really doing +anything. + +I presume you also run ANALYZE in some shape or form periodically? + +> space of a few days we find that updates start getting painfully slow. +> We are running a full vacuum/analyze and reindex on the table every day, + +If they're short transactions, run vacuum (not vacuum full) every 100 or +so updates. This might even be once a minute. + +Analyze periodically as well. + +-- + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 15:27:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 78B5952C22 + for ; + Thu, 14 Jul 2005 15:26:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63775-03 + for ; + Thu, 14 Jul 2005 18:26:54 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 8556252C02 + for ; + Thu, 14 Jul 2005 15:26:53 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 3634015234; Thu, 14 Jul 2005 13:26:53 -0500 (CDT) +Date: Thu, 14 Jul 2005 13:26:52 -0500 +From: "Jim C. Nasby" +To: Nicolas Beaume +Cc: pgsql-performance@postgresql.org +Subject: Re: large table vs multiple smal tables +Message-ID: <20050714182651.GB92165@decibel.org> +References: <42D4E836.9020607@univ-nantes.fr> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42D4E836.9020607@univ-nantes.fr> +X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/183 +X-Sequence-Number: 13424 + +On Wed, Jul 13, 2005 at 12:08:54PM +0200, Nicolas Beaume wrote: +> Hello +> +> I have a large database with 4 large tables (each containing at least +> 200 000 rows, perhaps even 1 or 2 million) and i ask myself if it's +> better to split them into small tables (e.g tables of 2000 rows) to +> speed the access and the update of those tables (considering that i will +> have few update but a lot of reading). + +2 million rows is nothing unless you're on a 486 or something. As for +your other question, remember the first rule of performance tuning: +don't tune unless you actually need to. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Thu Jul 14 15:29:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 987DF52C32 + for ; + Thu, 14 Jul 2005 15:29:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60982-09 + for ; + Thu, 14 Jul 2005 18:29:56 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id CA42252C2D + for ; + Thu, 14 Jul 2005 15:29:54 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 22AC715234; Thu, 14 Jul 2005 13:29:48 -0500 (CDT) +Date: Thu, 14 Jul 2005 13:29:48 -0500 +From: "Jim C. Nasby" +To: "Jeffrey W. Baker" +Cc: pgsql-performance@postgresql.org +Subject: Re: JFS fastest filesystem for PostgreSQL? +Message-ID: <20050714182948.GC92165@decibel.org> +References: <1121322821.6719.0.camel@noodles> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1121322821.6719.0.camel@noodles> +X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/184 +X-Sequence-Number: 13425 + +On Wed, Jul 13, 2005 at 11:33:41PM -0700, Jeffrey W. Baker wrote: +> [reposted due to delivery error -jwb] +> +> I just took delivery of a new system, and used the opportunity to +> benchmark postgresql 8.0 performance on various filesystems. The system +> in question runs Linux 2.6.12, has one CPU and 1GB of system memory, and +> 5 7200RPM SATA disks attached to an Areca hardware RAID controller +> having 128MB of cache. The caches are all write-back. +> +> I ran pgbench with a scale factor of 1000 and a total of 100,000 +> transactions per run. I varied the number of clients between 10 and +> 100. It appears from my test JFS is much faster than both ext3 and XFS +> for this workload. JFS and XFS were made with the mkfs defaults. ext3 +> was made with -T largefile4 and -E stride=32. The deadline scheduler +> was used for all runs (anticipatory scheduler is much worse). +> +> Here's the result, in transactions per second. +> +> ext3 jfs xfs +> ----------------------------- +> 10 Clients 55 81 68 +> 100 Clients 61 100 64 +> ---------------------------- + +BTW, it'd be interesting to see how UFS on FreeBSD compared. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Thu Jul 14 15:37:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5E25652C22 + for ; + Thu, 14 Jul 2005 15:37:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65061-06 + for ; + Thu, 14 Jul 2005 18:37:14 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 755E252C02 + for ; + Thu, 14 Jul 2005 15:37:13 -0300 (ADT) +Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j6EIbAoQ030071; Thu, 14 Jul 2005 11:37:10 -0700 +Message-ID: <42D6B0D6.6000101@commandprompt.com> +Date: Thu, 14 Jul 2005 11:37:10 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Jim C. Nasby" +Cc: "Jeffrey W. Baker" , + pgsql-performance@postgresql.org +Subject: Re: JFS fastest filesystem for PostgreSQL? +References: <1121322821.6719.0.camel@noodles> + <20050714182948.GC92165@decibel.org> +In-Reply-To: <20050714182948.GC92165@decibel.org> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/185 +X-Sequence-Number: 13426 + + +>>I ran pgbench with a scale factor of 1000 and a total of 100,000 +>>transactions per run. I varied the number of clients between 10 and +>>100. It appears from my test JFS is much faster than both ext3 and XFS +>>for this workload. JFS and XFS were made with the mkfs defaults. ext3 +>>was made with -T largefile4 and -E stride=32. The deadline scheduler +>>was used for all runs (anticipatory scheduler is much worse). +>> +>>Here's the result, in transactions per second. +>> +>> ext3 jfs xfs +>>----------------------------- +>> 10 Clients 55 81 68 +>>100 Clients 61 100 64 +>>---------------------------- + +I would be curious as to what options were passed to jfs and xfs. + +Sincerely, + +Joshua D. Drake + + +> +> +> BTW, it'd be interesting to see how UFS on FreeBSD compared. + + +-- +Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 +PostgreSQL Replication, Consulting, Custom Programming, 24x7 support +Managed Services, Shared and Dedicated Hosting +Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ + +From pgsql-performance-owner@postgresql.org Thu Jul 14 17:47:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3F4AD52C41 + for ; + Thu, 14 Jul 2005 17:47:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93472-03 + for ; + Thu, 14 Jul 2005 20:47:10 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id B97BF52AA1 + for ; + Thu, 14 Jul 2005 17:47:08 -0300 (ADT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1DtAbn-0008IM-00; Thu, 14 Jul 2005 16:47:03 -0400 +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: Quad Opteron stuck in the mud +References: + <87oe95ykz5.fsf@stark.xeocode.com> + +In-Reply-To: +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 14 Jul 2005 16:47:02 -0400 +Message-ID: <87k6jtw1x5.fsf@stark.xeocode.com> +Lines: 61 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/186 +X-Sequence-Number: 13427 + +Dan Harris writes: + +> Well, once every day, but there aren't a ton of inserts or updates going on a +> daily basis. Maybe 1,000 total inserts? + +It's actually deletes and updates that matter. not inserts. + +> I have a feeling I'm going to need to do a cluster soon. I have done several +> mass deletes and reloads on it. + +CLUSTER effectively does a VACUUM FULL but takes a different approach and +writes out a whole new table, which if there's lots of free space is faster +than moving records around to compact the table. + +> I tried that, and indeed it was using an index, although after reading Simon's +> post, I realize that was kind of dumb to have an index on a bool. I have since +> removed it. + +If there are very few records (like well under 10%) with that column equal to +false (or very few equal to true) then it's not necessarily useless. But +probably more useful is a partial index on some other column. + +Something like + +CREATE INDEX ON pk WHERE flag = false; + +> No foreign keys or triggers. + +Note that I'm talking about foreign keys in *other* tables that refer to +columns in this table. Every update on this table would have to scan those +other tables looking for records referencing the updated rows. + + +> Ok, so I remounted this drive as ext2 shortly before sending my first email +> today. It wasn't enough time for me to notice the ABSOLUTELY HUGE difference +> in performance change. Ext3 must really be crappy for postgres, or at least +> is on this box. Now that it's ext2, this thing is flying like never before. +> My CPU utilization has skyrocketed, telling me that the disk IO was +> constraining it immensely. +> +> I always knew that it might be a little faster, but the box feels like it can +> "breathe" again and things that used to be IO intensive and run for an hour or +> more are now running in < 5 minutes. I'm a little worried about not having a +> journalized file system, but that performance difference will keep me from +> switching back ( at least to ext3! ). Maybe someday I will try XFS. + +@spock(Fascinating). + +I wonder if ext3 might be issuing IDE cache flushes on every fsync (to sync +the journal) whereas ext2 might not be issuing any cache flushes at all. + +If the IDE cache is never being flushed then you'll see much better +performance but run the risk of data loss in a power failure or hardware +failure. (But not in the case of an OS crash, or at least no more than +otherwise.) + +You could also try using the "-O journal_dev" option to put the ext3 journal +on a separate device. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 17:48:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 53BFC52C91 + for ; + Thu, 14 Jul 2005 17:48:17 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93152-06 + for ; + Thu, 14 Jul 2005 20:48:08 +0000 (GMT) +Received: from cmailm2.svr.pol.co.uk (cmailm2.svr.pol.co.uk [195.92.193.210]) + by svr1.postgresql.org (Postfix) with ESMTP id 504EE52C41 + for ; + Thu, 14 Jul 2005 17:48:07 -0300 (ADT) +Received: from modem-1171.leopard.dialup.pol.co.uk ([217.135.148.147] + helo=192.168.0.102) by cmailm2.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DtAcj-0002Wl-7O; Thu, 14 Jul 2005 21:48:01 +0100 +Subject: Re: Profiler for PostgreSQL +From: Simon Riggs +To: Christopher Kings-Lynne +Cc: Agha Asif Raza , + pgsql-performance@postgresql.org +In-Reply-To: <42D60664.90400@familyhealth.com.au> +References: <8d1c715f05071322582a27b996@mail.gmail.com> + <42D60664.90400@familyhealth.com.au> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Thu, 14 Jul 2005 21:47:46 +0100 +Message-Id: <1121374066.3970.450.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/187 +X-Sequence-Number: 13428 + +On Thu, 2005-07-14 at 14:29 +0800, Christopher Kings-Lynne wrote: +> Try turning on query logging and using the 'pqa' utility on pgfoundry.org. + +Have you got that to work for 8 ? + +pqa 1.5 doesn't even work with its own test file. + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 19:30:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8E0A752BCA + for ; + Thu, 14 Jul 2005 19:30:08 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13632-07 + for ; + Thu, 14 Jul 2005 22:30:05 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 721195287D + for ; + Thu, 14 Jul 2005 19:30:01 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id 36E55644159 + for ; + Thu, 14 Jul 2005 16:29:39 -0600 (MDT) +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 10917-07 for ; + Thu, 14 Jul 2005 16:29:36 -0600 (MDT) +Received: from [192.168.1.100] (c-67-162-134-190.hsd1.co.comcast.net + [67.162.134.190]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id 02D4F644151 + for ; + Thu, 14 Jul 2005 16:29:35 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +In-Reply-To: <42D687E5.7080202@arbash-meinel.com> +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +From: Dan Harris +Subject: Re: slow joining very large table to smaller ones +Date: Thu, 14 Jul 2005 16:29:58 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/188 +X-Sequence-Number: 13429 + + +On Jul 14, 2005, at 9:42 AM, John A Meinel wrote: +> +> +> You might try giving it a little bit more freedom with: +> +> EXPLAIN ANALYZE +> SELECT recordtext FROM eventactivity, k_r, k_b +> WHERE eventactivity.incidentid = k_r.incidentid +> AND eventactivity.incidentid = k_b.incidentid +> AND k_r.id = 94 +> AND k_b.id = 107 +> -- AND k_r.incidentid = k_b.incidentid +> ; +> +> I'm pretty sure that would give identical results, just let the +> planner +> have a little bit more freedom about how it does it. +> Also the last line is commented out, because I think it is redundant. +> + +Ok, I tried this one. My ssh keeps getting cut off by a router +somewhere between me and the server due to inactivity timeouts, so +all I know is that both the select and explain analyze are taking +over an hour to run. Here's the explain select for that one, since +that's the best I can get. + +explain select recordtext from eventactivity,k_r,k_b where +eventactivity.incidentid = k_r.incidentid and +eventactivity.incidentid = k_b.incidentid and k_r.id = 94 and k_b.id += 107; + QUERY PLAN +------------------------------------------------------------------------ +-------------------------------------- +Merge Join (cost=9624.61..4679590.52 rows=151009549 width=35) + Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") + -> Merge Join (cost=4766.92..4547684.26 rows=16072733 width=117) + Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") + -> Index Scan using eventactivity1 on eventactivity +(cost=0.00..4186753.16 rows=46029271 width=49) + -> Sort (cost=4766.92..4771.47 rows=1821 width=68) + Sort Key: (k_b.incidentid)::text + -> Index Scan using k_b_idx on k_b +(cost=0.00..4668.31 rows=1821 width=68) + Index Cond: (id = 107) + -> Sort (cost=4857.69..4862.39 rows=1879 width=68) + Sort Key: (k_r.incidentid)::text + -> Index Scan using k_r_idx on k_r (cost=0.00..4755.52 +rows=1879 width=68) + Index Cond: (id = 94) +(13 rows) + + + +> You might also try: +> EXPLAIN ANALYZE +> SELECT recordtext +> FROM eventactivity JOIN k_r USING (incidentid) +> JOIN k_b USING (incidentid) +> WHERE k_r.id = 94 +> AND k_b.id = 107 +> ; +> + +Similar results here. The query is taking at least an hour to finish. + +explain select recordtext from eventactivity join k_r using +( incidentid ) join k_b using (incidentid ) where k_r.id = 94 and +k_b.id = 107; + + QUERY PLAN +------------------------------------------------------------------------ +-------------------------------------- +Merge Join (cost=9542.77..4672831.12 rows=148391132 width=35) + Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") + -> Merge Join (cost=4726.61..4542825.87 rows=15930238 width=117) + Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") + -> Index Scan using eventactivity1 on eventactivity +(cost=0.00..4184145.43 rows=46000104 width=49) + -> Sort (cost=4726.61..4731.13 rows=1806 width=68) + Sort Key: (k_b.incidentid)::text + -> Index Scan using k_b_idx on k_b +(cost=0.00..4628.92 rows=1806 width=68) + Index Cond: (id = 107) + -> Sort (cost=4816.16..4820.82 rows=1863 width=68) + Sort Key: (k_r.incidentid)::text + -> Index Scan using k_r_idx on k_r (cost=0.00..4714.97 +rows=1863 width=68) + Index Cond: (id = 94) +(13 rows) + + + +> Also, if possible give us the EXPLAIN ANALYZE so that we know if the +> planner is making accurate estimates. (You might send an EXPLAIN while +> waiting for the EXPLAIN ANALYZE to finish) +> +> You can also try disabling merge joins, and see how that changes +> things. +> + +Are there any negative sideaffects of doing this? + +> +>> +>> +> +> Well, postgres is estimating around 500 rows each, is that way off? +> Try +> just doing: +> EXPLAIN ANALYZE SELECT incidentid FROM k_b WHERE id = 107; +> EXPLAIN ANALYZE SELECT incidentid FROM k_r WHERE id = 94; +> +> And see if postgres estimates the number of rows properly. +> +> I assume you have recently VACUUM ANALYZEd, which means you might need +> to update the statistics target (ALTER TABLE k_b ALTER COLUMN +> incidientid SET STATISTICS 100) default is IIRC 10, ranges from +> 1-1000, +> higher is more accurate, but makes ANALYZE slower. +> +> +>> +>> Right now, it looks like pg is trying to sort the entire +>> eventactivity +>> table for the merge join which is taking several minutes to do. +>> Can I +>> rephrase this so that it does the searching through k_r and k_b +>> FIRST +>> and then go into eventactivity using the index on incidentid? It +>> seems +>> like that shouldn't be too hard to make fast but my SQL query skills +>> are only average. +>> +> +> To me, it looks like it is doing an index scan (on k_b.id) through k_b +> first, sorting the results by incidentid, then merge joining that with +> eventactivity. +> +> I'm guessing you actually want it to merge k_b and k_r to get extra +> selectivity before joining against eventactivity. +> I think my alternate forms would let postgres realize this. But if +> not, +> you could try: +> +> EXPLAIN ANALYZE +> SELECT recordtext FROM eventactivity +> JOIN (SELECT incidentid FROM k_r JOIN k_b USING (incidentid) +> WHERE k_r.id = 94 AND k_b.id = 107) +> USING (incidentid); +> + +This one looks like the same plan as the others: + +explain select recordtext from eventactivity join ( select incidentid +from k_r join k_b using (incidentid) where k_r.id = 94 and k_b.id = +107 ) a using (incidentid ); + QUERY PLAN +------------------------------------------------------------------------ +-------------------------------------- +Merge Join (cost=9793.33..4693149.15 rows=156544758 width=35) + Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") + -> Merge Join (cost=4847.75..4557237.59 rows=16365843 width=117) + Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") + -> Index Scan using eventactivity1 on eventactivity +(cost=0.00..4191691.79 rows=46084161 width=49) + -> Sort (cost=4847.75..4852.38 rows=1852 width=68) + Sort Key: (k_b.incidentid)::text + -> Index Scan using k_b_idx on k_b +(cost=0.00..4747.24 rows=1852 width=68) + Index Cond: (id = 107) + -> Sort (cost=4945.58..4950.36 rows=1913 width=68) + Sort Key: (k_r.incidentid)::text + -> Index Scan using k_r_idx on k_r (cost=0.00..4841.30 +rows=1913 width=68) + Index Cond: (id = 94) +(13 rows) + + + +> I don't know how selective your keys are, but one of these queries +> should probably structure it better for the planner. It depends a +> lot on +> how selective your query is. + +eventactivity currently has around 36 million rows in it. There +should only be maybe 200-300 incidentids at most that will be matched +with the combination of k_b and k_r. That's why I was thinking I +could somehow get a list of just the incidentids that matched the id += 94 and id = 107 in k_b and k_r first. Then, I would only need to +grab a few hundred out of 36 million rows from eventactivity. + +> If you have 100M rows, the above query looks like it expects k_r to +> restrict it to 44M rows, and k_r + k_b down to 11M rows, which really +> should be a seq scan (> 10% of the rows = seq scan). But if you are +> saying the selectivity is mis-estimated it could be different. +> + +Yeah, if I understand you correctly, I think the previous paragraph +shows this is a significant misestimate. + + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 19:46:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A694D5287D + for ; + Thu, 14 Jul 2005 19:46:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19756-03 + for ; + Thu, 14 Jul 2005 22:46:23 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id 64DA652814 + for ; + Thu, 14 Jul 2005 19:46:22 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050714224623m920006dife>; Thu, 14 Jul 2005 22:46:23 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id AD53D55FF0; Thu, 14 Jul 2005 17:46:22 -0500 (CDT) +Received: from [192.168.1.102] (65-100-20-12.cdrr.qwest.net [65.100.20.12]) + by juju.arbash-meinel.com (Postfix) with ESMTP id C534955FF0; + Thu, 14 Jul 2005 17:46:16 -0500 (CDT) +Message-ID: <42D6EB31.9040909@arbash-meinel.com> +Date: Thu, 14 Jul 2005 17:46:09 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: slow joining very large table to smaller ones +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + +In-Reply-To: +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig934AD7077F7DA9AB52E83521" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.027 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/189 +X-Sequence-Number: 13430 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig934AD7077F7DA9AB52E83521 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Dan Harris wrote: +> +> On Jul 14, 2005, at 9:42 AM, John A Meinel wrote: + +... +Did you try doing this to see how good the planners selectivity +estimates are? + +>> Well, postgres is estimating around 500 rows each, is that way off? Try +>> just doing: +>> EXPLAIN ANALYZE SELECT incidentid FROM k_b WHERE id = 107; +>> EXPLAIN ANALYZE SELECT incidentid FROM k_r WHERE id = 94; + +These should be fast queries. + +John +=:-> + +--------------enig934AD7077F7DA9AB52E83521 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC1usxJdeBCYSNAAMRAk5XAKCFggsfmcdSCEGUkeqRYx8M2+Q0mQCg2XEr +dWjvGIfwMNGw4Szff32o9gM= +=6zRN +-----END PGP SIGNATURE----- + +--------------enig934AD7077F7DA9AB52E83521-- + +From pgsql-performance-owner@postgresql.org Thu Jul 14 19:47:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 049A552D82 + for ; + Thu, 14 Jul 2005 19:47:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18602-08 + for ; + Thu, 14 Jul 2005 22:47:49 +0000 (GMT) +Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) + by svr1.postgresql.org (Postfix) with ESMTP id 2741A52D73 + for ; + Thu, 14 Jul 2005 19:47:45 -0300 (ADT) +Received: from osgiliath.mathom.us ([70.108.75.132]) + by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IJN00D2C3BNFKJ1@vms048.mailsrvcs.net> for + pgsql-performance@postgresql.org; Thu, 14 Jul 2005 17:47:48 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id 72BCA6005EA; Thu, + 14 Jul 2005 18:47:47 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 24705-01; Thu, 14 Jul 2005 18:47:47 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id 14ED3600197; Thu, 14 Jul 2005 18:47:47 -0400 (EDT) +Date: Thu, 14 Jul 2005 18:47:46 -0400 +From: Michael Stone +Subject: Re: slow joining very large table to smaller ones +In-reply-to: +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Mail-Followup-To: Dan Harris , + pgsql-performance@postgresql.org +Message-id: <20050714224746.GD19080@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/190 +X-Sequence-Number: 13431 + +On Thu, Jul 14, 2005 at 04:29:58PM -0600, Dan Harris wrote: +>Ok, I tried this one. My ssh keeps getting cut off by a router +>somewhere between me and the server due to inactivity timeouts, so +>all I know is that both the select and explain analyze are taking +>over an hour to run. + +Try running the query as a script with nohup & redirect the output to a +file. + +Mike Stone + +From pgsql-performance-owner@postgresql.org Thu Jul 14 20:08:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9875252C60 + for ; + Thu, 14 Jul 2005 20:08:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21401-06 + for ; + Thu, 14 Jul 2005 23:08:42 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 14B2A52C5A + for ; + Thu, 14 Jul 2005 20:08:41 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6EN8hiU005546; + Thu, 14 Jul 2005 19:08:43 -0400 (EDT) +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: slow joining very large table to smaller ones +In-reply-to: +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + +Comments: In-reply-to Dan Harris + message dated "Thu, 14 Jul 2005 16:29:58 -0600" +Date: Thu, 14 Jul 2005 19:08:43 -0400 +Message-ID: <5545.1121382523@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/191 +X-Sequence-Number: 13432 + +Dan Harris writes: +> Here's the explain select for that one, since +> that's the best I can get. + +> explain select recordtext from eventactivity,k_r,k_b where +> eventactivity.incidentid = k_r.incidentid and +> eventactivity.incidentid = k_b.incidentid and k_r.id = 94 and k_b.id +> = 107; +> QUERY PLAN +> ------------------------------------------------------------------------ +> -------------------------------------- +> Merge Join (cost=9624.61..4679590.52 rows=151009549 width=35) +> Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") +> -> Merge Join (cost=4766.92..4547684.26 rows=16072733 width=117) +> Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") +> -> Index Scan using eventactivity1 on eventactivity +> (cost=0.00..4186753.16 rows=46029271 width=49) +> -> Sort (cost=4766.92..4771.47 rows=1821 width=68) +> Sort Key: (k_b.incidentid)::text +> -> Index Scan using k_b_idx on k_b +> (cost=0.00..4668.31 rows=1821 width=68) +> Index Cond: (id = 107) +> -> Sort (cost=4857.69..4862.39 rows=1879 width=68) +> Sort Key: (k_r.incidentid)::text +> -> Index Scan using k_r_idx on k_r (cost=0.00..4755.52 +> rows=1879 width=68) +> Index Cond: (id = 94) +> (13 rows) + +There's something awfully fishy here. The 8.0 planner is definitely +capable of figuring out that it ought to join the smaller relations +first. As an example, using 8.0.3+ (CVS branch tip) I did + +regression=# create table eventactivity(incidentid varchar, recordtext text); +CREATE TABLE +regression=# create table k_r(incidentid varchar); +CREATE TABLE +regression=# create table k_b(incidentid varchar); +CREATE TABLE +regression=# explain select recordtext from eventactivity inner join +(select incidentid from k_r) a using (incidentid) +inner join (select incidentid from k_b) b using (incidentid); + +(Being too impatient to actually fill the eventactivity table with 36M +rows of data, I just did some debugger magic to make the planner think +that that was the table size...) The default plan looks like + + Merge Join (cost=16137814.70..36563453.23 rows=1361700000 width=32) + Merge Cond: (("outer".incidentid)::text = "inner"."?column3?") + -> Merge Join (cost=170.85..290.48 rows=7565 width=64) + Merge Cond: ("outer"."?column2?" = "inner"."?column2?") + -> Sort (cost=85.43..88.50 rows=1230 width=32) + Sort Key: (k_r.incidentid)::text + -> Seq Scan on k_r (cost=0.00..22.30 rows=1230 width=32) + -> Sort (cost=85.43..88.50 rows=1230 width=32) + Sort Key: (k_b.incidentid)::text + -> Seq Scan on k_b (cost=0.00..22.30 rows=1230 width=32) + -> Sort (cost=16137643.84..16227643.84 rows=36000000 width=64) + Sort Key: (eventactivity.incidentid)::text + -> Seq Scan on eventactivity (cost=0.00..1080000.00 rows=36000000 width=64) + +and if I "set enable_mergejoin TO 0;" I get + + Hash Join (cost=612.54..83761451.54 rows=1361700000 width=32) + Hash Cond: (("outer".incidentid)::text = ("inner".incidentid)::text) + -> Seq Scan on eventactivity (cost=0.00..1080000.00 rows=36000000 width=64) + -> Hash (cost=504.62..504.62 rows=7565 width=64) + -> Hash Join (cost=25.38..504.62 rows=7565 width=64) + Hash Cond: (("outer".incidentid)::text = ("inner".incidentid)::text) + -> Seq Scan on k_r (cost=0.00..22.30 rows=1230 width=32) + -> Hash (cost=22.30..22.30 rows=1230 width=32) + -> Seq Scan on k_b (cost=0.00..22.30 rows=1230 width=32) + +which is the plan I would judge Most Likely To Succeed based on what we +know about Dan's problem. (The fact that the planner is estimating it +as twice as expensive as the mergejoin comes from the fact that with no +statistics about the join keys, the planner deliberately estimates hash +join as expensive, because it can be pretty awful in the presence of +many equal keys.) + +So the planner is certainly capable of finding the desired plan, even +without any tweaking of the query text. This means that what we have +is mainly a statistical problem. Have you ANALYZEd these tables +recently? If so, may we see the pg_stats rows for incidentid in all +three tables? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 14 20:14:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B7EC552C6C + for ; + Thu, 14 Jul 2005 20:14:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23979-04 + for ; + Thu, 14 Jul 2005 23:13:52 +0000 (GMT) +Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) + by svr1.postgresql.org (Postfix) with ESMTP id 177DC52C5C + for ; + Thu, 14 Jul 2005 20:13:51 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP + id <20050714231353m9100k91dpe>; Thu, 14 Jul 2005 23:13:54 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 514AF55FFC; Thu, 14 Jul 2005 18:13:53 -0500 (CDT) +Received: from [192.168.1.102] (65-100-20-12.cdrr.qwest.net [65.100.20.12]) + by juju.arbash-meinel.com (Postfix) with ESMTP id C57A355FF0; + Thu, 14 Jul 2005 18:13:38 -0500 (CDT) +Message-ID: <42D6F177.3000002@arbash-meinel.com> +Date: Thu, 14 Jul 2005 18:12:55 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: slow joining very large table to smaller ones +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + +In-Reply-To: +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigC423413175948A4F4F847397" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.028 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/192 +X-Sequence-Number: 13433 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigC423413175948A4F4F847397 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Dan Harris wrote: +> +> On Jul 14, 2005, at 9:42 AM, John A Meinel wrote: +> +>> +>> +>> You might try giving it a little bit more freedom with: +>> +>> EXPLAIN ANALYZE +>> SELECT recordtext FROM eventactivity, k_r, k_b +>> WHERE eventactivity.incidentid = k_r.incidentid +>> AND eventactivity.incidentid = k_b.incidentid +>> AND k_r.id = 94 +>> AND k_b.id = 107 +>> -- AND k_r.incidentid = k_b.incidentid +>> ; +>> +>> I'm pretty sure that would give identical results, just let the planner +>> have a little bit more freedom about how it does it. +>> Also the last line is commented out, because I think it is redundant. +>> +> +> Ok, I tried this one. My ssh keeps getting cut off by a router +> somewhere between me and the server due to inactivity timeouts, so all +> I know is that both the select and explain analyze are taking over an +> hour to run. Here's the explain select for that one, since that's the +> best I can get. +> +> explain select recordtext from eventactivity,k_r,k_b where +> eventactivity.incidentid = k_r.incidentid and eventactivity.incidentid +> = k_b.incidentid and k_r.id = 94 and k_b.id = 107; +> QUERY PLAN +> ------------------------------------------------------------------------ +> -------------------------------------- +> Merge Join (cost=9624.61..4679590.52 rows=151009549 width=35) +> Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") +> -> Merge Join (cost=4766.92..4547684.26 rows=16072733 width=117) +> Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") +> -> Index Scan using eventactivity1 on eventactivity +> (cost=0.00..4186753.16 rows=46029271 width=49) +> -> Sort (cost=4766.92..4771.47 rows=1821 width=68) +> Sort Key: (k_b.incidentid)::text +> -> Index Scan using k_b_idx on k_b (cost=0.00..4668.31 +> rows=1821 width=68) +> Index Cond: (id = 107) +> -> Sort (cost=4857.69..4862.39 rows=1879 width=68) +> Sort Key: (k_r.incidentid)::text +> -> Index Scan using k_r_idx on k_r (cost=0.00..4755.52 +> rows=1879 width=68) +> Index Cond: (id = 94) +> (13 rows) +> + +If anything, the estimations have gotten worse. As now it thinks there +will be 1800 rows returned each, whereas you were thinking it would be +more around 100. + +Since you didn't say, you did VACUUM ANALYZE recently, right? + +> + +... + +>> +>> You can also try disabling merge joins, and see how that changes things. +>> +> +> Are there any negative sideaffects of doing this? + +If the planner is estimating things correctly, you want to give it the +most flexibility of plans to pick from, because sometimes a merge join +is faster (postgres doesn't pick things because it wants to go slower). +The only reason for the disable flags is that sometimes the planner +doesn't estimate correctly. Usually disabling a method is not the final +solution, but a way to try out different methods, and see what happens +to the results. + +Using: SET enable_mergejoin TO off; +You can disable it just for the current session (not for the entire +database). Which is the recommended way if you have a query that +postgres is messing up on. (Usually it is correct elsewhere). + + +>> +>> Well, postgres is estimating around 500 rows each, is that way off? Try +>> just doing: +>> EXPLAIN ANALYZE SELECT incidentid FROM k_b WHERE id = 107; +>> EXPLAIN ANALYZE SELECT incidentid FROM k_r WHERE id = 94; + +Once again, do this and post the results. We might just need to tweak +your settings so that it estimates the number of rows correctly, and we +don't need to do anything else. + +>> +>> And see if postgres estimates the number of rows properly. +>> +>> I assume you have recently VACUUM ANALYZEd, which means you might need +>> to update the statistics target (ALTER TABLE k_b ALTER COLUMN +>> incidientid SET STATISTICS 100) default is IIRC 10, ranges from 1-1000, +>> higher is more accurate, but makes ANALYZE slower. +>> + + +... + +>> EXPLAIN ANALYZE +>> SELECT recordtext FROM eventactivity +>> JOIN (SELECT incidentid FROM k_r JOIN k_b USING (incidentid) +>> WHERE k_r.id = 94 AND k_b.id = 107) +>> USING (incidentid); +>> +> +> This one looks like the same plan as the others: +> +> explain select recordtext from eventactivity join ( select incidentid +> from k_r join k_b using (incidentid) where k_r.id = 94 and k_b.id = 107 +> ) a using (incidentid ); + +Well, the planner is powerful enough to flatten nested selects. To make +it less "intelligent" you can do: +SET join_collapse_limit 1; +or +SET join_collapse_limit 0; +Which should tell postgres to not try and get tricky with your query. +Again, *usually* the planner knows better than you do. So again just do +it to see what you get. + +The problem is that if you are only using EXPLAIN SELECT, you will +probably get something which *looks* worse. Because if it looked better, +the planner would have used it. That is why you really need the EXPLAIN +ANALYZE, so that you can see where the planner is incorrect in it's +estimates. + + +> QUERY PLAN +> ------------------------------------------------------------------------ +> -------------------------------------- +> Merge Join (cost=9793.33..4693149.15 rows=156544758 width=35) +> Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") +> -> Merge Join (cost=4847.75..4557237.59 rows=16365843 width=117) +> Merge Cond: (("outer".incidentid)::text = "inner"."?column2?") +> -> Index Scan using eventactivity1 on eventactivity +> (cost=0.00..4191691.79 rows=46084161 width=49) +> -> Sort (cost=4847.75..4852.38 rows=1852 width=68) +> Sort Key: (k_b.incidentid)::text +> -> Index Scan using k_b_idx on k_b (cost=0.00..4747.24 +> rows=1852 width=68) +> Index Cond: (id = 107) +> -> Sort (cost=4945.58..4950.36 rows=1913 width=68) +> Sort Key: (k_r.incidentid)::text +> -> Index Scan using k_r_idx on k_r (cost=0.00..4841.30 +> rows=1913 width=68) +> Index Cond: (id = 94) +> (13 rows) +> + +What I don't understand is that the planner is actually estimating that +joining against the new table is going to *increase* the number of +returned rows. +Because the final number of rows here is 156M while the initial join +shows only 16M. +And it also thinks that it will only grab 46M rows from eventactivity. + +If you have analyzed recently can you do: +SELECT relname, reltuples FROM pg_class WHERE relname='eventactivity'; + +It is a cheaper form than "SELECT count(*) FROM eventactivity" to get an +approximate estimate of the number of rows. But if it isn't too +expensive, please also give the value from SELECT count(*) FROM +eventactivity. + +Again, that helps us know if your tables are up-to-date. + + +> +> +>> I don't know how selective your keys are, but one of these queries +>> should probably structure it better for the planner. It depends a lot on +>> how selective your query is. +> +> +> eventactivity currently has around 36 million rows in it. There should +> only be maybe 200-300 incidentids at most that will be matched with the +> combination of k_b and k_r. That's why I was thinking I could somehow +> get a list of just the incidentids that matched the id = 94 and id = +> 107 in k_b and k_r first. Then, I would only need to grab a few hundred +> out of 36 million rows from eventactivity. +> + +Well, you can also try: +SELECT count(*) FROM k_b JOIN k_r USING (incidentid) + WHERE k_b.id=?? AND k_r.id=?? +; + +That will tell you how many rows they have in common. + +>> If you have 100M rows, the above query looks like it expects k_r to +>> restrict it to 44M rows, and k_r + k_b down to 11M rows, which really +>> should be a seq scan (> 10% of the rows = seq scan). But if you are +>> saying the selectivity is mis-estimated it could be different. +>> +> +> Yeah, if I understand you correctly, I think the previous paragraph +> shows this is a significant misestimate. +> + +Well, if you look at the latest plans, things have gone up from 44M to +156M, I don't know why it is worse, but it is getting there. + +John +=:-> + +--------------enigC423413175948A4F4F847397 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC1vF3JdeBCYSNAAMRAgXCAKCXgpSixITwsvr8NvXZKTcmXyprnQCdHwQR +uTYwazpzK/ZyRRlx2+TLKxM= +=7UD2 +-----END PGP SIGNATURE----- + +--------------enigC423413175948A4F4F847397-- + +From pgsql-performance-owner@postgresql.org Thu Jul 14 20:30:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A457152B0D + for ; + Thu, 14 Jul 2005 20:30:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24847-08 + for ; + Thu, 14 Jul 2005 23:30:05 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8CA5752C63 + for ; + Thu, 14 Jul 2005 20:30:03 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6ENU2Zr005709; + Thu, 14 Jul 2005 19:30:02 -0400 (EDT) +To: John A Meinel +Cc: Dan Harris , + pgsql-performance@postgresql.org +Subject: Re: slow joining very large table to smaller ones +In-reply-to: <42D6F177.3000002@arbash-meinel.com> +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + + <42D6F177.3000002@arbash-meinel.com> +Comments: In-reply-to John A Meinel + message dated "Thu, 14 Jul 2005 18:12:55 -0500" +Date: Thu, 14 Jul 2005 19:30:02 -0400 +Message-ID: <5708.1121383802@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/193 +X-Sequence-Number: 13434 + +John A Meinel writes: +> What I don't understand is that the planner is actually estimating that +> joining against the new table is going to *increase* the number of +> returned rows. + +It evidently thinks that incidentid in the k_r table is pretty +nonunique. We really need to look at the statistics data to +see what's going on. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 14 20:40:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1903152814 + for ; + Thu, 14 Jul 2005 20:40:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28735-10 + for ; + Thu, 14 Jul 2005 23:40:16 +0000 (GMT) +Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) + by svr1.postgresql.org (Postfix) with ESMTP id 860C652C6B + for ; + Thu, 14 Jul 2005 20:40:12 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP + id <20050714234011m9100k85k1e>; Thu, 14 Jul 2005 23:40:16 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id B51E355FFC; Thu, 14 Jul 2005 18:40:07 -0500 (CDT) +Received: from [192.168.1.102] (65-100-20-12.cdrr.qwest.net [65.100.20.12]) + by juju.arbash-meinel.com (Postfix) with ESMTP id A941D55FF0; + Thu, 14 Jul 2005 18:40:02 -0500 (CDT) +Message-ID: <42D6F7CE.5010007@arbash-meinel.com> +Date: Thu, 14 Jul 2005 18:39:58 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: Dan Harris , + pgsql-performance@postgresql.org +Subject: Re: slow joining very large table to smaller ones +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + + <42D6F177.3000002@arbash-meinel.com> + <5708.1121383802@sss.pgh.pa.us> +In-Reply-To: <5708.1121383802@sss.pgh.pa.us> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig20905F1FC17C14B2B7F6EFD9" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/194 +X-Sequence-Number: 13435 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig20905F1FC17C14B2B7F6EFD9 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Tom Lane wrote: +> John A Meinel writes: +> +>>What I don't understand is that the planner is actually estimating that +>>joining against the new table is going to *increase* the number of +>>returned rows. +> +> +> It evidently thinks that incidentid in the k_r table is pretty +> nonunique. We really need to look at the statistics data to +> see what's going on. +> +> regards, tom lane +> + +Okay, sure. What about doing this, then: + +EXPLAIN ANALYZE +SELECT recordtext FROM eventactivity + JOIN (SELECT DISTINCT incidentid FROM k_r JOIN k_b USING (incidentid) + WHERE k_r.id = ?? AND k_b.id = ??) + USING (incidentid) +; + +Since I assume that eventactivity is the only table with "recordtext", +and that you don't get any columns from k_r and k_b, meaning it would be +pointless to get duplicate incidentids. + +I may be misunderstanding what the query is trying to do, but depending +on what is in k_r and k_b, is it possible to use a UNIQUE INDEX rather +than just an index on incidentid? + +There is also the possibility of +EXPLAIN ANALYZE +SELECT recordtext FROM eventactivtity + JOIN (SELECT incidentid FROM k_r WHERE k_r.id = ?? + UNION SELECT incidentid FROM k_b WHERE k_b.id = ??) + USING (incidentid) +; + +But both of these would mean that you don't actually want columns from +k_r or k_b, just a unique list of incident ids. + +But first, I agree, we should make sure the pg_stats values are reasonable. + +John +=:-> + + +--------------enig20905F1FC17C14B2B7F6EFD9 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC1vfPJdeBCYSNAAMRAgTWAJoDylT5gpCS6knbpQ0ztcboKlp/GACgsWSb +zm/lpqNKxkD6fOywBwCNIls= +=n7aS +-----END PGP SIGNATURE----- + +--------------enig20905F1FC17C14B2B7F6EFD9-- + +From pgsql-performance-owner@postgresql.org Thu Jul 14 20:42:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E663D52B0D + for ; + Thu, 14 Jul 2005 20:42:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28191-06 + for ; + Thu, 14 Jul 2005 23:42:14 +0000 (GMT) +Received: from ash25e.internode.on.net (ash25e.internode.on.net + [203.16.214.182]) + by svr1.postgresql.org (Postfix) with ESMTP id 09BDD52B5B + for ; + Thu, 14 Jul 2005 20:42:12 -0300 (ADT) +Received: from pluto.mirrabooka.com (ppp188-133.static.internode.on.net + [150.101.188.133]) + by ash25e.internode.on.net (8.12.9/8.12.6) with ESMTP id j6ENgDEa061538 + for ; + Fri, 15 Jul 2005 09:12:14 +0930 (CST) + (envelope-from alison@mirrabooka.com) +Received: by pluto.mirrabooka.com (Postfix, from userid 506) + id A6D522B11E; Fri, 15 Jul 2005 09:42:12 +1000 (EST) +Date: Fri, 15 Jul 2005 09:42:12 +1000 +To: pgsql-performance@postgresql.org +Subject: Re: lots of updates on small table +Message-ID: <42D6F854.nail3K81VIICH@pluto.mirrabooka.com> +References: <42D5F34E.nail9QE1195IE@pluto.mirrabooka.com> + <20050714162114.GA19778@alvh.no-ip.org> +In-Reply-To: <20050714162114.GA19778@alvh.no-ip.org> +User-Agent: nail 11.6 9/7/04 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +From: alison@mirrabooka.com (Alison Winters) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/195 +X-Sequence-Number: 13436 + +Hi, + +> > Our application requires a number of processes to select and update rows +> > from a very small (<10 rows) Postgres table on a regular and frequent +> > basis. These processes often run for weeks at a time, but over the +> > space of a few days we find that updates start getting painfully slow. +> > We are running a full vacuum/analyze and reindex on the table every day, +> Full vacuum, eh? I wonder if what you really need is very frequent +> non-full vacuum. Say, once in 15 minutes (exact rate depending on dead +> tuple rate.) +> +Is there a difference between vacuum and vacuum full? Currently we have +a cron job going every hour that does: + +VACUUM FULL VERBOSE ANALYZE plc_fldio +REINDEX TABLE plc_fldio + +The most recent output was this: + +INFO: --Relation public.plc_fldio-- +INFO: Pages 1221: Changed 3, reaped 256, Empty 0, New 0; Tup 108137: Vac 4176, Keep/VTL 108133/108133, UnUsed 19, MinLen 84, MaxLen 84; Re-using: Free/Avail. Space 445176/371836; EndEmpty/Avail. Pages 0/256. + CPU 0.04s/0.14u sec elapsed 0.18 sec. +INFO: Index plcpage_idx: Pages 315; Tuples 108137: Deleted 4176. + CPU 0.03s/0.04u sec elapsed 0.14 sec. +INFO: Rel plc_fldio: Pages: 1221 --> 1221; Tuple(s) moved: 0. + CPU 0.03s/0.04u sec elapsed 0.36 sec. +INFO: Analyzing public.plc_fldio +VACUUM +REINDEX + +We'll up it to every 15 minutes, but i don't know if that'll help +because even with the current vacuuming the updates are still getting +slower and slower over the course of several days. What really puzzles +me is why restarting the processes fixes it. Does PostgreSQL keep some +kind of backlog of transactions all for one database connection? Isn't +it normal to have processes that keep a single database connection open +for days at a time? + +Regarding the question another poster asked: all the transactions are +very short. The table is essentially a database replacement for a +shared memory segment - it contains a few rows of byte values that are +constantly updated byte-at-a-time to communicate data between different +industrial control processes. + +Thanks for the thoughts everyone, + +Alison + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 20:52:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 05A7252C34 + for ; + Thu, 14 Jul 2005 20:52:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 26328-07 + for ; + Thu, 14 Jul 2005 23:52:30 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id 4443E52C46 + for ; + Thu, 14 Jul 2005 20:52:29 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050714235232m920006unne>; Thu, 14 Jul 2005 23:52:32 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 6205F55FFD; Thu, 14 Jul 2005 18:52:32 -0500 (CDT) +Received: from [192.168.1.102] (65-100-20-12.cdrr.qwest.net [65.100.20.12]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 91A5955FFA; + Thu, 14 Jul 2005 18:52:26 -0500 (CDT) +Message-ID: <42D6FAB8.9030103@arbash-meinel.com> +Date: Thu, 14 Jul 2005 18:52:24 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Alison Winters +Cc: pgsql-performance@postgresql.org +Subject: Re: lots of updates on small table +References: <42D5F34E.nail9QE1195IE@pluto.mirrabooka.com> + <20050714162114.GA19778@alvh.no-ip.org> + <42D6F854.nail3K81VIICH@pluto.mirrabooka.com> +In-Reply-To: <42D6F854.nail3K81VIICH@pluto.mirrabooka.com> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig379259FCDF523B5F31208C09" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.031 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/196 +X-Sequence-Number: 13437 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig379259FCDF523B5F31208C09 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Alison Winters wrote: +> Hi, +> +> +>>>Our application requires a number of processes to select and update rows +>>>from a very small (<10 rows) Postgres table on a regular and frequent +>>>basis. These processes often run for weeks at a time, but over the +>>>space of a few days we find that updates start getting painfully slow. +>>>We are running a full vacuum/analyze and reindex on the table every day, +>> +>>Full vacuum, eh? I wonder if what you really need is very frequent +>>non-full vacuum. Say, once in 15 minutes (exact rate depending on dead +>>tuple rate.) +>> +> +> Is there a difference between vacuum and vacuum full? Currently we have +> a cron job going every hour that does: +> +> VACUUM FULL VERBOSE ANALYZE plc_fldio +> REINDEX TABLE plc_fldio + +VACUUM FULL exclusively locks the table (so that nothing else can +happen) and the compacts it as much as it can. +You almost definitely want to only VACUUM every 15min, maybe VACUUM FULL +1/day. + +VACUUM FULL is more for when you haven't been VACUUMing often enough. Or +have major changes to your table. +Basically VACUUM marks rows as empty and available for reuse, VACUUM +FULL removes empty space (but requires a full lock, because it is moving +rows around). + +If anything, I would estimate that VACUUM FULL would be hurting your +performance. But it may happen fast enough not to matter. + +> +> The most recent output was this: +> +> INFO: --Relation public.plc_fldio-- +> INFO: Pages 1221: Changed 3, reaped 256, Empty 0, New 0; Tup 108137: Vac 4176, Keep/VTL 108133/108133, UnUsed 19, MinLen 84, MaxLen 84; Re-using: Free/Avail. Space 445176/371836; EndEmpty/Avail. Pages 0/256. +> CPU 0.04s/0.14u sec elapsed 0.18 sec. +> INFO: Index plcpage_idx: Pages 315; Tuples 108137: Deleted 4176. +> CPU 0.03s/0.04u sec elapsed 0.14 sec. +> INFO: Rel plc_fldio: Pages: 1221 --> 1221; Tuple(s) moved: 0. +> CPU 0.03s/0.04u sec elapsed 0.36 sec. +> INFO: Analyzing public.plc_fldio +> VACUUM +> REINDEX +> +> We'll up it to every 15 minutes, but i don't know if that'll help +> because even with the current vacuuming the updates are still getting +> slower and slower over the course of several days. What really puzzles +> me is why restarting the processes fixes it. Does PostgreSQL keep some +> kind of backlog of transactions all for one database connection? Isn't +> it normal to have processes that keep a single database connection open +> for days at a time? + +I believe that certain locks are grabbed per session. Or at least there +is some command that you can run, which you don't want to run in a +maintained connection. (It might be VACUUM FULL, I don't remember which +one it is). + +But the fact that your application works at all seems to be that it +isn't acquiring any locks. + +I know VACUUM cannot clean up any rows that are visible in one of the +transactions, I don't know if this includes active connections or not. + +> +> Regarding the question another poster asked: all the transactions are +> very short. The table is essentially a database replacement for a +> shared memory segment - it contains a few rows of byte values that are +> constantly updated byte-at-a-time to communicate data between different +> industrial control processes. +> +> Thanks for the thoughts everyone, +> +> Alison +> + +Is it possible to have some sort of timer that would recognize it has +been connected for too long, drop the database connection, and +reconnect? I don't know that it would solve anything, but it would be +something you could try. + +John +=:-> + + +--------------enig379259FCDF523B5F31208C09 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC1vq4JdeBCYSNAAMRAslFAJ9U+XYt88G/+8jsqdqaA0WlVh4IHACgrMba +pOpfm6NZgTyXss6Vc3fr9JM= +=FPqm +-----END PGP SIGNATURE----- + +--------------enig379259FCDF523B5F31208C09-- + +From pgsql-performance-owner@postgresql.org Thu Jul 14 20:57:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1131952C3B + for ; + Thu, 14 Jul 2005 20:57:36 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28199-09 + for ; + Thu, 14 Jul 2005 23:57:26 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1B46752BC7 + for ; + Thu, 14 Jul 2005 20:57:25 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6ENvRLR005894; + Thu, 14 Jul 2005 19:57:27 -0400 (EDT) +To: alison@mirrabooka.com (Alison Winters) +Cc: pgsql-performance@postgresql.org +Subject: Re: lots of updates on small table +In-reply-to: <42D6F854.nail3K81VIICH@pluto.mirrabooka.com> +References: <42D5F34E.nail9QE1195IE@pluto.mirrabooka.com> + <20050714162114.GA19778@alvh.no-ip.org> + <42D6F854.nail3K81VIICH@pluto.mirrabooka.com> +Comments: In-reply-to alison@mirrabooka.com (Alison Winters) + message dated "Fri, 15 Jul 2005 09:42:12 +1000" +Date: Thu, 14 Jul 2005 19:57:27 -0400 +Message-ID: <5893.1121385447@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/197 +X-Sequence-Number: 13438 + +alison@mirrabooka.com (Alison Winters) writes: +>>> Our application requires a number of processes to select and update rows +>>> from a very small (<10 rows) Postgres table on a regular and frequent +>>> basis. These processes often run for weeks at a time, but over the +>>> space of a few days we find that updates start getting painfully slow. + +No wonder, considering that your "less than 10 rows" table contains +something upwards of 100000 tuples: + +> INFO: --Relation public.plc_fldio-- +> INFO: Pages 1221: Changed 3, reaped 256, Empty 0, New 0; Tup 108137: Vac 4176, Keep/VTL 108133/108133, UnUsed 19, MinLen 84, MaxLen 84; Re-using: Free/Avail. Space 445176/371836; EndEmpty/Avail. Pages 0/256. +> CPU 0.04s/0.14u sec elapsed 0.18 sec. + +What you need to do is find out why VACUUM is unable to reclaim all +those dead row versions. The reason is likely that some process is +sitting on a open transaction for days at a time. + +> Isn't it normal to have processes that keep a single database +> connection open for days at a time? + +Database connection, sure. Single transaction, no. + +> Regarding the question another poster asked: all the transactions are +> very short. + +Somewhere you have one that isn't. Try watching the backends with ps, +or look at the pg_stat_activity view if your version of PG has it, +to see which sessions are staying "idle in transaction" indefinitely. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 14 21:12:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B0F8452C72 + for ; + Thu, 14 Jul 2005 21:12:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31032-10 + for ; + Fri, 15 Jul 2005 00:12:12 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 470F152C71 + for ; + Thu, 14 Jul 2005 21:12:10 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id A732D6441F1 + for ; + Thu, 14 Jul 2005 18:11:50 -0600 (MDT) +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 12146-06 for ; + Thu, 14 Jul 2005 18:11:48 -0600 (MDT) +Received: from [192.168.1.100] (c-67-162-134-190.hsd1.co.comcast.net + [67.162.134.190]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id D5C956441ED + for ; + Thu, 14 Jul 2005 18:11:47 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +In-Reply-To: <42D6F177.3000002@arbash-meinel.com> +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + + <42D6F177.3000002@arbash-meinel.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +From: Dan Harris +Subject: Re: slow joining very large table to smaller ones +Date: Thu, 14 Jul 2005 18:12:07 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/198 +X-Sequence-Number: 13439 + + +On Jul 14, 2005, at 5:12 PM, John A Meinel wrote: + +> Dan Harris wrote: +> +> +>>> +>>> Well, postgres is estimating around 500 rows each, is that way +>>> off? Try +>>> just doing: +>>> EXPLAIN ANALYZE SELECT incidentid FROM k_b WHERE id = 107; +>>> EXPLAIN ANALYZE SELECT incidentid FROM k_r WHERE id = 94; +>>> +> +> Once again, do this and post the results. We might just need to tweak +> your settings so that it estimates the number of rows correctly, +> and we +> don't need to do anything else. +> + +Ok, sorry I missed these the first time through: + +explain analyze select incidentid from k_b where id = 107; + QUERY PLAN +------------------------------------------------------------------------ +------------------------------------------------ +Index Scan using k_b_idx on k_b (cost=0.00..1926.03 rows=675 +width=14) (actual time=0.042..298.394 rows=2493 loops=1) + Index Cond: (id = 107) +Total runtime: 299.103 ms + +select count(*) from k_b; +count +-------- +698350 + +( sorry! I think I said this one only had tens of thousands in it ) + + +explain analyze select incidentid from k_r where id = +94; QUERY PLAN +------------------------------------------------------------------------ +------------------------------------------------- +Index Scan using k_r_idx on k_r (cost=0.00..2137.61 rows=757 +width=14) (actual time=0.092..212.187 rows=10893 loops=1) + Index Cond: (id = 94) +Total runtime: 216.498 ms +(3 rows) + + +select count(*) from k_r; +count +-------- +671670 + + +That one is quite a bit slower, yet it's the same table structure and +same index as k_b, also it has fewer records. + +I did run VACUUM ANALYZE immediately before running these queries. +It seems a lot better with the join_collapse set. + +> +> \ +> Well, the planner is powerful enough to flatten nested selects. To +> make +> it less "intelligent" you can do: +> SET join_collapse_limit 1; +> or +> SET join_collapse_limit 0; +> Which should tell postgres to not try and get tricky with your query. +> Again, *usually* the planner knows better than you do. So again +> just do +> it to see what you get. +> + +Ok, when join_collapse_limit = 1 I get this now: + +explain analyze select recordtext from eventactivity join ( select +incidentid from k_r join k_b using (incidentid) where k_r.id = 94 and +k_b.id = 107 ) a using (incidentid ); + +QUERY PLAN +------------------------------------------------------------------------ +----------------------------------------------------------------------- +Nested Loop (cost=0.00..156509.08 rows=2948 width=35) (actual +time=1.555..340.625 rows=24825 loops=1) + -> Nested Loop (cost=0.00..5361.89 rows=6 width=28) (actual +time=1.234..142.078 rows=366 loops=1) + -> Index Scan using k_b_idx on k_b (cost=0.00..1943.09 +rows=681 width=14) (actual time=0.423..56.974 rows=2521 loops=1) + Index Cond: (id = 107) + -> Index Scan using k_r_idx on k_r (cost=0.00..5.01 +rows=1 width=14) (actual time=0.031..0.031 rows=0 loops=2521) + Index Cond: ((k_r.id = 94) AND +((k_r.incidentid)::text = ("outer".incidentid)::text)) + -> Index Scan using eventactivity1 on eventactivity +(cost=0.00..25079.55 rows=8932 width=49) (actual time=0.107..0.481 +rows=68 loops=366) + Index Cond: ((eventactivity.incidentid)::text = +("outer".incidentid)::text) +Total runtime: 347.975 ms + +MUCH better! Maybe you can help me understand what I did and if I +need to make something permanent to get this behavior from now on? + + + +> +> +> +> If you have analyzed recently can you do: +> SELECT relname, reltuples FROM pg_class WHERE relname='eventactivity'; +> +> It is a cheaper form than "SELECT count(*) FROM eventactivity" to +> get an +> approximate estimate of the number of rows. But if it isn't too +> expensive, please also give the value from SELECT count(*) FROM +> eventactivity. +> +> Again, that helps us know if your tables are up-to-date. +> + +Sure: + +select relname, reltuples from pg_class where relname='eventactivity'; + relname | reltuples +---------------+------------- +eventactivity | 3.16882e+07 + +select count(*) from eventactivity; + count +---------- +31871142 + + + + + +> +> +>> +>> +>> +>>> I don't know how selective your keys are, but one of these queries +>>> should probably structure it better for the planner. It depends +>>> a lot on +>>> how selective your query is. +>>> +>> +>> +>> eventactivity currently has around 36 million rows in it. There +>> should +>> only be maybe 200-300 incidentids at most that will be matched +>> with the +>> combination of k_b and k_r. That's why I was thinking I could +>> somehow +>> get a list of just the incidentids that matched the id = 94 and id = +>> 107 in k_b and k_r first. Then, I would only need to grab a few +>> hundred +>> out of 36 million rows from eventactivity. +>> +>> +> +> Well, you can also try: +> SELECT count(*) FROM k_b JOIN k_r USING (incidentid) +> WHERE k_b.id=?? AND k_r.id=?? +> ; +> +> That will tell you how many rows they have in common. + +select count(*) from k_b join k_r using (incidentid) where k_b.id=107 +and k_r.id=94; +count +------- + 373 + + + +> +> Well, if you look at the latest plans, things have gone up from 44M to +> 156M, I don't know why it is worse, but it is getting there. + +I assume this is because r_k and r_b are growing fairly rapidly right +now. The time in between queries contained a lot of inserts. I was +careful to vacuum analyze before sending statistics, as I did this +time. I'm sorry if this has confused the issue. + + + + +From pgsql-patches-owner@postgresql.org Thu Jul 14 21:22:39 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8AE8D52C84 + for ; + Thu, 14 Jul 2005 21:22:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40471-02 + for ; + Fri, 15 Jul 2005 00:22:32 +0000 (GMT) +Received: from mail.Mi8.com (mail.mi8.com [63.240.6.41]) + by svr1.postgresql.org (Postfix) with ESMTP id D91FF52834 + for ; + Thu, 14 Jul 2005 21:22:27 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- GW01 Welcome + to Mi8 Corporation www.Mi8.com); Thu, 14 Jul 2005 20:22:19 -0400 +X-Server-Uuid: F1A2E19A-84E4-48DD-8F48-B475613F58B2 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 14 Jul + 2005 20:22:19 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Thu, 14 Jul + 2005 20:22:18 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Thu, 14 Jul 2005 17:22:18 -0700 +Subject: Re: COPY FROM performance improvements +From: "Alon Goldshuv" +To: pgsql-patches@postgresql.org +Message-ID: +In-Reply-To: +MIME-Version: 1.0 +X-OriginalArrivalTime: 15 Jul 2005 00:22:19.0800 (UTC) + FILETIME=[43450180:01C588D3] +X-WSS-ID: 6EC9DE311J42555262-01-01 +Content-Type: multipart/mixed; + boundary=B_3204206540_47940875 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.601 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/314 +X-Sequence-Number: 16654 + +> This message is in MIME format. Since your mail reader does not understand +this format, some or all of this message may not be legible. + +--B_3204206540_47940875 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: 7bit + +I revisited my patch and removed the code duplications that were there, and +added support for CSV with buffered input, so CSV now runs faster too +(although it is not as optimized as the TEXT format parsing). So now +TEXT,CSV and BINARY are all parsed in CopyFrom(), like in the original file. + +Patch attached. + +Greetings, +Alon. + + + +--B_3204206540_47940875 +Content-Type: application/octet-stream; name=copy_parse_improvements_V15.patch +Content-Disposition: attachment; + filename=copy_parse_improvements_V15.patch +Content-Transfer-Encoding: base64 + +SW5kZXg6IHNyYy9iYWNrZW5kL2NvbW1hbmRzL2NvcHkuYwo9PT09PT09PT09PT09PT09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FwcGVuZWQuCisgICovCisgY2hhciAq +Cisgc2NhblRleHRBdHRyKGNvbnN0IGNoYXIgKnMsIGNoYXIgYzEsIGNoYXIgYzIsIHNpemVf +dCBsZW4pCisgeworIAljb25zdCBjaGFyICpzdGFydDsKKyAJCisgCWZvciAoc3RhcnQgPSBz +OyAqcyAhPSBjMSAmJiAqcyAhPSBjMiAmJiBzIDwgc3RhcnQgKyBsZW47IHMrKykKKyAJCTsK +KyAJCisgCXJldHVybiAoKnMgIT0gJ1wwJyA/IChjaGFyICopIHMgOiBOVUxMKTsKKyB9Cisg +CisgCisgCisgCisgCg== + +--B_3204206540_47940875-- + + +From pgsql-performance-owner@postgresql.org Thu Jul 14 21:28:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D751552C86 + for ; + Thu, 14 Jul 2005 21:28:21 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40748-03 + for ; + Fri, 15 Jul 2005 00:28:18 +0000 (GMT) +Received: from mr2.surnet.cl (smtp2.surnet.cl [216.155.73.163]) + by svr1.postgresql.org (Postfix) with ESMTP id F2C1852C82 + for ; + Thu, 14 Jul 2005 21:28:17 -0300 (ADT) +Received: from smtp2.surnet.cl (216.155.73.169) by mr2.surnet.cl (7.0.031.3) + id 4259ADFA01596C03; Thu, 14 Jul 2005 20:28:00 -0400 +Received: from smtp1.surnet.cl (smtp1.surnet.cl []) + by mr2.surnet.cl ([216.155.73.169]); Fri, 15 Jul 2005 00:27:59 +0000 +Received: from cluster.surnet.cl (216.155.73.164) by smtp1.surnet.cl + (7.0.031.3) id 42587C6E010862FF; Thu, 14 Jul 2005 20:27:39 -0400 +Received: from alvh.no-ip.org (200.85.218.66) by cluster.surnet.cl (7.0.043) + (authenticated as alvherre@surnet.cl) + id 42B3EF60003CD464; Thu, 14 Jul 2005 20:28:16 -0400 +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id 0D53DC370EE; Thu, 14 Jul 2005 20:28:24 -0400 (CLT) +Date: Thu, 14 Jul 2005 20:28:24 -0400 +From: Alvaro Herrera +To: Alison Winters +Cc: pgsql-performance@postgresql.org +Subject: Re: lots of updates on small table +Message-ID: <20050715002824.GA23728@alvh.no-ip.org> +References: <42D5F34E.nail9QE1195IE@pluto.mirrabooka.com> + <20050714162114.GA19778@alvh.no-ip.org> + <42D6F854.nail3K81VIICH@pluto.mirrabooka.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42D6F854.nail3K81VIICH@pluto.mirrabooka.com> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.384 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, RCVD_IN_NJABL_PROXY +X-Spam-Level: * +X-Archive-Number: 200507/199 +X-Sequence-Number: 13440 + +On Fri, Jul 15, 2005 at 09:42:12AM +1000, Alison Winters wrote: + +> > > Our application requires a number of processes to select and update rows +> > > from a very small (<10 rows) Postgres table on a regular and frequent +> > > basis. These processes often run for weeks at a time, but over the +> > > space of a few days we find that updates start getting painfully slow. +> > > We are running a full vacuum/analyze and reindex on the table every day, +> > Full vacuum, eh? I wonder if what you really need is very frequent +> > non-full vacuum. Say, once in 15 minutes (exact rate depending on dead +> > tuple rate.) +> > +> Is there a difference between vacuum and vacuum full? + +Yes. Vacuum full is more aggresive in compacting the table. Though it +really works the same in the presence of long-running transactions: +tuples just can't be removed. + +> The most recent output was this: +> +> INFO: --Relation public.plc_fldio-- +> INFO: Pages 1221: Changed 3, reaped 256, Empty 0, New 0; Tup 108137: Vac 4176, Keep/VTL 108133/108133, UnUsed 19, MinLen 84, MaxLen 84; Re-using: Free/Avail. Space 445176/371836; EndEmpty/Avail. Pages 0/256. +> CPU 0.04s/0.14u sec elapsed 0.18 sec. +> INFO: Index plcpage_idx: Pages 315; Tuples 108137: Deleted 4176. +> CPU 0.03s/0.04u sec elapsed 0.14 sec. +> INFO: Rel plc_fldio: Pages: 1221 --> 1221; Tuple(s) moved: 0. +> CPU 0.03s/0.04u sec elapsed 0.36 sec. +> INFO: Analyzing public.plc_fldio + +Hmm, so it seems your hourly vacuum is enough. I think the bloat theory +can be trashed. Unless I'm reading this output wrong; I don't remember +the details of this vacuum output. + +> We'll up it to every 15 minutes, but i don't know if that'll help +> because even with the current vacuuming the updates are still getting +> slower and slower over the course of several days. What really puzzles +> me is why restarting the processes fixes it. + +I wonder if the problem may be plan caching. I didn't pay full +attention to the description of your problem, so I don't remember if it +could be an issue, but it's something to consider. + +> Does PostgreSQL keep some kind of backlog of transactions all for one +> database connection? + +No. There could be a problem if you had very long transactions, but +apparently this isn't your problem. + +> Isn't it normal to have processes that keep a single database +> connection open for days at a time? + +I guess it depends on exactly what you do with it. I know of at least +one case where an app keeps a connection open for months, without a +problem. (It's been running for four or five years, and monthly +"uptime" for that particular daemon is not unheard of.) + +-- +Alvaro Herrera () +"Everybody understands Mickey Mouse. Few understand Hermann Hesse. +Hardly anybody understands Einstein. And nobody understands Emperor Norton." + +From pgsql-performance-owner@postgresql.org Thu Jul 14 21:37:32 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 226F152834 + for ; + Thu, 14 Jul 2005 21:37:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40007-09 + for ; + Fri, 15 Jul 2005 00:37:22 +0000 (GMT) +Received: from mr2.surnet.cl (smtp2.surnet.cl [216.155.73.163]) + by svr1.postgresql.org (Postfix) with ESMTP id CE27B52814 + for ; + Thu, 14 Jul 2005 21:37:21 -0300 (ADT) +Received: from smtp2.surnet.cl (216.155.73.169) by mr2.surnet.cl (7.0.031.3) + id 4259ADFA01597261; Thu, 14 Jul 2005 20:37:04 -0400 +Received: from smtp1.surnet.cl (smtp1.surnet.cl []) + by mr2.surnet.cl ([216.155.73.169]); Fri, 15 Jul 2005 00:37:04 +0000 +Received: from cluster.surnet.cl (216.155.73.164) by smtp1.surnet.cl + (7.0.031.3) id 42587C6E010866DA; Thu, 14 Jul 2005 20:36:44 -0400 +Received: from alvh.no-ip.org (200.85.218.66) by cluster.surnet.cl (7.0.043) + (authenticated as alvherre@surnet.cl) + id 42B3EF60003CD832; Thu, 14 Jul 2005 20:37:21 -0400 +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id 14989C370EE; Thu, 14 Jul 2005 20:37:30 -0400 (CLT) +Date: Thu, 14 Jul 2005 20:37:30 -0400 +From: Alvaro Herrera +To: Alison Winters +Cc: pgsql-performance@postgresql.org +Subject: Re: lots of updates on small table +Message-ID: <20050715003729.GB23728@alvh.no-ip.org> +References: <42D5F34E.nail9QE1195IE@pluto.mirrabooka.com> + <20050714162114.GA19778@alvh.no-ip.org> + <42D6F854.nail3K81VIICH@pluto.mirrabooka.com> + <20050715002824.GA23728@alvh.no-ip.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050715002824.GA23728@alvh.no-ip.org> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.383 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, RCVD_IN_NJABL_PROXY +X-Spam-Level: * +X-Archive-Number: 200507/200 +X-Sequence-Number: 13441 + +On Thu, Jul 14, 2005 at 08:28:24PM -0400, Alvaro Herrera wrote: +> On Fri, Jul 15, 2005 at 09:42:12AM +1000, Alison Winters wrote: +> + +> > INFO: Pages 1221: Changed 3, reaped 256, Empty 0, New 0; Tup 108137: Vac 4176, Keep/VTL 108133/108133, UnUsed 19, MinLen 84, MaxLen 84; Re-using: Free/Avail. Space 445176/371836; EndEmpty/Avail. Pages 0/256. +> +> Hmm, so it seems your hourly vacuum is enough. I think the bloat theory +> can be trashed. Unless I'm reading this output wrong; I don't remember +> the details of this vacuum output. + +Ok, so I was _very_ wrong :-) Sorry. + +-- +Alvaro Herrera () +Essentially, you're proposing Kevlar shoes as a solution for the problem +that you want to walk around carrying a loaded gun aimed at your foot. +(Tom Lane) + +From pgsql-performance-owner@postgresql.org Thu Jul 14 21:43:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CF83552D19 + for ; + Thu, 14 Jul 2005 21:43:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39841-08 + for ; + Fri, 15 Jul 2005 00:43:14 +0000 (GMT) +Received: from smtp001.bizmail.yahoo.com (smtp001.bizmail.yahoo.com + [216.136.172.125]) + by svr1.postgresql.org (Postfix) with SMTP id 37D2C52A58 + for ; + Thu, 14 Jul 2005 21:43:11 -0300 (ADT) +Received: (qmail 1265 invoked from network); 15 Jul 2005 00:43:14 -0000 +Received: from unknown (HELO ?192.168.3.41?) + (david.mitchell@telogis.com@203.98.10.169 with plain) + by smtp001.bizmail.yahoo.com with SMTP; 15 Jul 2005 00:43:14 -0000 +Message-ID: <42D7069B.5090107@telogis.com> +Date: Fri, 15 Jul 2005 12:43:07 +1200 +From: David Mitchell +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dennis +Cc: Qingqing Zhou , + pgsql-performance@postgresql.org +Subject: Re: performance problems ... 100 cpu utilization +References: <42D567DB.6000100@works4me.com> + <42D5DBEB.4010503@works4me.com> <42D5F315.3090301@telogis.com> + <42D60C2E.3020004@works4me.com> +In-Reply-To: <42D60C2E.3020004@works4me.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-Archive-Number: 200507/201 +X-Sequence-Number: 13442 + +If your table has got into this state, then vacuum analyze won't fix it. +You will have to do a vacuum full to get it back to normal, then +regularly vacuum (not full) to keep it in good condition. We vacuum our +critical tables every 10 minutes to keep them in good nick. + +David + +Dennis wrote: +> David Mitchell wrote: +> +>> What is the load average on this machine? Do you do many updates? If +>> you do a lot of updates, perhaps you haven't vacuumed recently. We +>> were seeing similar symptoms when we started load testing our stuff +>> and it turned out we were vacuuming too infrequently. +> +> +> The load average at the 100% utilization point was about 30! A vacuum +> analyze was done before the test was started. I believe there are many +> more selects than updates happening at any one time. +> +> Dennis +> +> ---------------------------(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 +> +> + + +-- +David Mitchell +Software Engineer +Telogis + +From pgsql-performance-owner@postgresql.org Thu Jul 14 23:26:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 94DBB52ADF + for ; + Thu, 14 Jul 2005 23:26:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65237-03 + for ; + Fri, 15 Jul 2005 02:26:07 +0000 (GMT) +Received: from ash25e.internode.on.net (ash25e.internode.on.net + [203.16.214.182]) + by svr1.postgresql.org (Postfix) with ESMTP id 3DC0652A42 + for ; + Thu, 14 Jul 2005 23:26:06 -0300 (ADT) +Received: from pluto.mirrabooka.com (ppp188-133.static.internode.on.net + [150.101.188.133]) + by ash25e.internode.on.net (8.12.9/8.12.6) with ESMTP id j6F2Q9k2041662 + for ; + Fri, 15 Jul 2005 11:56:09 +0930 (CST) + (envelope-from alison@mirrabooka.com) +Received: by pluto.mirrabooka.com (Postfix, from userid 506) + id 646292B11E; Fri, 15 Jul 2005 12:26:09 +1000 (EST) +Date: Fri, 15 Jul 2005 12:26:09 +1000 +To: pgsql-performance@postgresql.org +Subject: Re: lots of updates on small table +Message-ID: <42D71EC1.nail8BK11QC2Q@pluto.mirrabooka.com> +References: <42D5F34E.nail9QE1195IE@pluto.mirrabooka.com> + <20050714162114.GA19778@alvh.no-ip.org> + <42D6F854.nail3K81VIICH@pluto.mirrabooka.com> + <5893.1121385447@sss.pgh.pa.us> +In-Reply-To: <5893.1121385447@sss.pgh.pa.us> +User-Agent: nail 11.6 9/7/04 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +From: alison@mirrabooka.com (Alison Winters) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/202 +X-Sequence-Number: 13443 + +Hi all, + +> No wonder, considering that your "less than 10 rows" table contains +> something upwards of 100000 tuples: +> +> > INFO: --Relation public.plc_fldio-- +> > INFO: Pages 1221: Changed 3, reaped 256, Empty 0, New 0; Tup 108137: Vac 4176, Keep/VTL 108133/108133, UnUsed 19, MinLen 84, MaxLen 84; Re-using: Free/Avail. Space 445176/371836; EndEmpty/Avail. Pages 0/256. +> > CPU 0.04s/0.14u sec elapsed 0.18 sec. +> +> What you need to do is find out why VACUUM is unable to reclaim all +> those dead row versions. The reason is likely that some process is +> sitting on a open transaction for days at a time. +> +Cheers mate, that was one of our theories but we weren't sure if it'd be +worth rebuilding everything to check. We've been compiling without the +-t (autocommit) flag to ecpg, and i believe what's happening is +sometimes a transaction is begun and then the processes cycle around +doing hardware i/o and never commit or only commit way too late. What +we're going to try now is remove all the begins and commits from the +code and compile with -t to make sure that any updates happen +immediately. Hopefully that'll avoid any hanging transactions. + +We'll also set up a 10-minutely vacuum (not full) as per some other +suggestions here. I'll let you know how it goes - we'll probably slot +everything in on Monday so we have a week to follow it. + +Thanks everyone +Alison + + +From pgsql-performance-owner@postgresql.org Fri Jul 15 00:50:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D6F4F52A1E + for ; + Fri, 15 Jul 2005 00:50:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89667-03 + for ; + Fri, 15 Jul 2005 03:50:10 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id CA5D752CC2 + for ; + Fri, 15 Jul 2005 00:50:07 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id 407E564424D + for ; + Thu, 14 Jul 2005 21:49:43 -0600 (MDT) +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 13970-09 for ; + Thu, 14 Jul 2005 21:49:41 -0600 (MDT) +Received: from [192.168.1.12] (c-24-9-24-35.hsd1.co.comcast.net [24.9.24.35]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id 05D15644238 + for ; + Thu, 14 Jul 2005 21:49:41 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +In-Reply-To: <42D70E42.90403@arbash-meinel.com> +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + + <42D6F177.3000002@arbash-meinel.com> + + <42D70E42.90403@arbash-meinel.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +From: Dan Harris +Subject: Re: slow joining very large table to smaller ones +Date: Thu, 14 Jul 2005 21:49:50 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/203 +X-Sequence-Number: 13444 + + +On Jul 14, 2005, at 7:15 PM, John A Meinel wrote: +> +> +> Is the distribution of your rows uneven? Meaning do you have more rows +> with a later id than an earlier one? +> + +There are definitely some id's that will have many times more than +the others. If I group and count them, the top 10 are fairly +dominant in the table. +>> +> +> Hmm.. How to do it permanantly? Well you could always issue "set +> join_collapse set 1; select * from ...." +> But obviously that isn't what you prefer. :) +> +> I think there are things you can do to make merge join more expensive +> than a nested loop, but I'm not sure what they are. + +Maybe someone else has some ideas to encourage this behavior for +future work? Setting it on a per-connection basis is doable, but +would add some burden to us in code. + +> +> What I really don't understand is that the estimates dropped as well. +> The actual number of estimate rows drops to 3k instead of > 1M. +> The real question is why does the planner think it will be so +> expensive? +> +> +>> select count(*) from k_b join k_r using (incidentid) where k_b.id=107 +>> and k_r.id=94; +>> count +>> ------- +>> 373 +>> +>> +> +> Well, this says that they are indeed much more selective. +> Each one has > 1k rows, but together you end up with only 400. +> + +Is this a bad thing? Is this not "selective enough" to make it much +faster? + +Overall, I'm much happier now after seeing the new plan come about, +if I can find a way to make that join_collapse behavior permanent, I +can certainly live with these numbers. + +Thanks again for your continued efforts. + +-Dan + +From pgsql-performance-owner@postgresql.org Fri Jul 15 01:12:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 79FBE529AA + for ; + Fri, 15 Jul 2005 01:12:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95070-09 + for ; + Fri, 15 Jul 2005 04:12:23 +0000 (GMT) +Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) + by svr1.postgresql.org (Postfix) with ESMTP id 69A1D529A3 + for ; + Fri, 15 Jul 2005 01:12:22 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP + id <20050715041220m9100k83j1e>; Fri, 15 Jul 2005 04:12:20 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id DE84E55FFC; Thu, 14 Jul 2005 23:12:19 -0500 (CDT) +Received: from [192.168.1.12] (Jigglypuff.arbash-meinel.com [192.168.1.12]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 7016055FF0; + Thu, 14 Jul 2005 23:12:15 -0500 (CDT) +Message-ID: <42D7379F.3040806@arbash-meinel.com> +Date: Thu, 14 Jul 2005 23:12:15 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: slow joining very large table to smaller ones +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + + <42D6F177.3000002@arbash-meinel.com> + + <42D70E42.90403@arbash-meinel.com> + +In-Reply-To: +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigFA1CDD21736CEC465830FA59" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.047 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/204 +X-Sequence-Number: 13445 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigFA1CDD21736CEC465830FA59 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Dan Harris wrote: +> +> On Jul 14, 2005, at 7:15 PM, John A Meinel wrote: +> +>> +>> +>> Is the distribution of your rows uneven? Meaning do you have more rows +>> with a later id than an earlier one? +>> +> +> There are definitely some id's that will have many times more than the +> others. If I group and count them, the top 10 are fairly dominant in +> the table. + +That usually skews the estimates. Since the estimate is more of an +average (unless the statistics are higher). + +> +>>> +>> +>> Hmm.. How to do it permanantly? Well you could always issue "set +>> join_collapse set 1; select * from ...." +>> But obviously that isn't what you prefer. :) +>> +>> I think there are things you can do to make merge join more expensive +>> than a nested loop, but I'm not sure what they are. +> +> +> Maybe someone else has some ideas to encourage this behavior for future +> work? Setting it on a per-connection basis is doable, but would add +> some burden to us in code. + +My biggest question is why the planner things the Nested Loop would be +so expensive. +Have you tuned any of the parameters? It seems like something is out of +whack. (cpu_tuple_cost, random_page_cost, etc...) + +> +>> +>> What I really don't understand is that the estimates dropped as well. +>> The actual number of estimate rows drops to 3k instead of > 1M. +>> The real question is why does the planner think it will be so expensive? +>> +>> +>>> select count(*) from k_b join k_r using (incidentid) where k_b.id=107 +>>> and k_r.id=94; +>>> count +>>> ------- +>>> 373 +>>> +>>> +>> +>> Well, this says that they are indeed much more selective. +>> Each one has > 1k rows, but together you end up with only 400. +>> +> +> Is this a bad thing? Is this not "selective enough" to make it much +> faster? + +Yes, being more selective is what makes it faster. But the planner +doesn't seem to notice it properly. + +> +> Overall, I'm much happier now after seeing the new plan come about, if +> I can find a way to make that join_collapse behavior permanent, I can +> certainly live with these numbers. +> + +I'm sure there are pieces to tune, but I've reached my limits of +parameters to tweak :) + +> Thanks again for your continued efforts. +> +> -Dan +> + +John +=:-> + +--------------enigFA1CDD21736CEC465830FA59 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC1zefJdeBCYSNAAMRAvKrAKDP+f07ZRNOAGveCwnKzT7Tk/oXlQCfZbKM +esJNh4xOtqMT334XcB+blCc= +=/WcL +-----END PGP SIGNATURE----- + +--------------enigFA1CDD21736CEC465830FA59-- + +From pgsql-performance-owner@postgresql.org Fri Jul 15 04:01:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A22F952D63 + for ; + Fri, 15 Jul 2005 04:01:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61410-05 + for ; + Fri, 15 Jul 2005 07:01:43 +0000 (GMT) +Received: from veggie-fuel.com (veggie-fuel.com [200.46.208.238]) + by svr1.postgresql.org (Postfix) with ESMTP id CA1DD52D60 + for ; + Fri, 15 Jul 2005 04:01:43 -0300 (ADT) +Received: from localhost (unknown [200.46.204.144]) + by veggie-fuel.com (Postfix) with ESMTP id 4B8FA35F952 + for ; + Fri, 15 Jul 2005 07:01:44 +0000 (GMT) +Received: from veggie-fuel.com ([200.46.208.238]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62470-04 for ; + Fri, 15 Jul 2005 07:01:37 +0000 (GMT) +Received: from [10.0.0.7] (63-229-107-222.phnx.qwest.net [63.229.107.222]) + by veggie-fuel.com (Postfix) with ESMTP id 238E535F94E + for ; + Fri, 15 Jul 2005 07:01:37 +0000 (GMT) +Subject: What's a lot of connections? +From: Karim Nassar +Reply-To: karim.nassar@acm.org +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Date: Fri, 15 Jul 2005 00:00:58 -0700 +Message-Id: <1121410859.4715.87.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/211 +X-Sequence-Number: 13452 + +I am working on a system that uses postgresql 7.4.2 (can't change that +until 8.1 goes stable). Just figured out that there are about 285,000 +connections created over about 11 hours every day. That averages out to +about 7.2 connections per second. + +Is that a lot? I've never seen that many. + +-- +Karim Nassar + + +From pgsql-performance-owner@postgresql.org Fri Jul 15 04:14:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1883852D18 + for ; + Fri, 15 Jul 2005 04:14:48 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63856-08 + for ; + Fri, 15 Jul 2005 07:14:42 +0000 (GMT) +Received: from mail28.sea5.speakeasy.net (mail28.sea5.speakeasy.net + [69.17.117.30]) + by svr1.postgresql.org (Postfix) with ESMTP id 7AA8352D16 + for ; + Fri, 15 Jul 2005 04:14:41 -0300 (ADT) +Received: (qmail 23607 invoked from network); 15 Jul 2005 07:14:42 -0000 +Received: from dsl081-060-184.sfo1.dsl.speakeasy.net (HELO noodles) + ([64.81.60.184]) (envelope-sender ) + by mail28.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP + for ; 15 Jul 2005 07:14:42 -0000 +Received: from jwb by noodles with local (Exim 3.36 #1 (Debian)) + id 1DtKPC-00021N-00; Fri, 15 Jul 2005 00:14:42 -0700 +Subject: Re: What's a lot of connections? +From: "Jeffrey W. Baker" +To: karim.nassar@acm.org +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1121410859.4715.87.camel@localhost.localdomain> +References: <1121410859.4715.87.camel@localhost.localdomain> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Date: Fri, 15 Jul 2005 00:14:42 -0700 +Message-Id: <1121411682.7733.0.camel@noodles> +Mime-Version: 1.0 +X-Mailer: Evolution 2.3.4 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/212 +X-Sequence-Number: 13453 + +On Fri, 2005-07-15 at 00:00 -0700, Karim Nassar wrote: +> I am working on a system that uses postgresql 7.4.2 (can't change that +> until 8.1 goes stable). Just figured out that there are about 285,000 +> connections created over about 11 hours every day. That averages out to +> about 7.2 connections per second. +> +> Is that a lot? I've never seen that many. + +I see about 8 million connections per full day. Connecting to postgres +is cheap. + +-jwb + +From pgsql-performance-owner@postgresql.org Fri Jul 15 05:20:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 45B1E52AB2 + for ; + Fri, 15 Jul 2005 05:19:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80418-06 + for ; + Fri, 15 Jul 2005 08:19:20 +0000 (GMT) +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.177]) + by svr1.postgresql.org (Postfix) with ESMTP id BDFE652BC7 + for ; + Fri, 15 Jul 2005 05:19:16 -0300 (ADT) +Received: from p548F1BEE.dip0.t-ipconnect.de [84.143.27.238] + (helo=pse.dyndns.org) + by mrelayeu.kundenserver.de with ESMTP (Nemesis), + id 0ML21M-1DtLPf078E-0005Zr; Fri, 15 Jul 2005 10:19:15 +0200 +Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) + id 1DtLPd-0003rO-I9; Fri, 15 Jul 2005 10:19:13 +0200 +Message-ID: <42D7717C.7020208@pse-consulting.de> +Date: Fri, 15 Jul 2005 08:19:08 +0000 +From: Andreas Pflug +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Bruce Momjian +Cc: Agha Asif Raza , + pgsql-performance@postgresql.org +Subject: Re: Profiler for PostgreSQL +References: <200507140627.j6E6RWv11806@candle.pha.pa.us> +In-Reply-To: <200507140627.j6E6RWv11806@candle.pha.pa.us> +X-Enigmail-Version: 0.89.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:0ce7ee5c3478b8d72edd8e05ccd40b70 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.314 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/213 +X-Sequence-Number: 13454 + +Bruce Momjian wrote: +> Agha Asif Raza wrote: +> +>>Is there any MS-SQL Server like 'Profiler' available for PostgreSQL? A +>>profiler is a tool that monitors the database server and outputs a detailed +>>trace of all the transactions/queries that are executed on a database during +>>a specified period of time. Kindly let me know if any of you knows of such a +>>tool for PostgreSQL. +>> Agha Asif Raza +> +> +> Sure see log_statement in postgresql.conf. There are a lot of settings +> in there to control what is logged. + +There's nothing really comparable at the moment, but some tasks can be +done with log_statement. +I'm planning to implement a full-blown profiling like MSSQL's, but don't +expect this too soon (I'm thinking about this for a year now. So many +plans, so little time). + +Regards, +Andreas + + + +From pgsql-performance-owner@postgresql.org Fri Jul 15 06:17:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 043B952A94 + for ; + Fri, 15 Jul 2005 06:17:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93100-02 + for ; + Fri, 15 Jul 2005 09:17:13 +0000 (GMT) +Received: from my.endian.it (unknown [62.146.87.34]) + by svr1.postgresql.org (Postfix) with ESMTP id BD83752A80 + for ; + Fri, 15 Jul 2005 06:17:11 -0300 (ADT) +Received: from dell.1006.org (host232-14.pool80183.interbusiness.it + [80.183.14.232]) (authenticated (0 bits)) + by my.endian.it (8.11.6/8.11.6) with ESMTP id j6F985M13202; + Fri, 15 Jul 2005 11:08:05 +0200 +Subject: Re: PostgresSQL vs. Firebird +From: Chris Mair +To: Relaxin +Cc: pgsql-performance@postgresql.org +In-Reply-To: +References: +Content-Type: text/plain +Date: Fri, 15 Jul 2005 11:17:11 +0200 +Message-Id: <1121419031.2721.9.camel@dell.1006.org> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.2 (2.2.2-5) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/214 +X-Sequence-Number: 13455 + + +On Thu, 2005-07-14 at 00:19 -0700, Relaxin wrote: +> Before I ask, I don't want to start a war. +> +> Can someone here give me an honest opinion of how PostgresSQL (PG) is better +> than Firebird on Windows? + +A colleague of mine has made some benchmarks using those two: +http://www.1006.org/pg/postgresql_firebird_win_linux.pdf + +He benchmarked inserts done through *his* own Delphi code varying a few +parameters. The servers run on Windows in all tests. The clients +were on Windows or Linux. + +The summary is that PG beats FB performance-wise in all tests except +when you do many small transactions (autocommit on) with fsync on. + +Bye, Chris. + + + + + +From pgsql-performance-owner@postgresql.org Fri Jul 15 11:16:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2E3D352B88 + for ; + Fri, 15 Jul 2005 11:16:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55579-04 + for ; + Fri, 15 Jul 2005 14:16:18 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6170752B13 + for ; + Fri, 15 Jul 2005 11:16:14 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6FEGH3x011127; + Fri, 15 Jul 2005 10:16:17 -0400 (EDT) +To: "Jeffrey W. Baker" +Cc: karim.nassar@acm.org, pgsql-performance@postgresql.org +Subject: Re: What's a lot of connections? +In-reply-to: <1121411682.7733.0.camel@noodles> +References: <1121410859.4715.87.camel@localhost.localdomain> + <1121411682.7733.0.camel@noodles> +Comments: In-reply-to "Jeffrey W. Baker" + message dated "Fri, 15 Jul 2005 00:14:42 -0700" +Date: Fri, 15 Jul 2005 10:16:16 -0400 +Message-ID: <11126.1121436976@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/215 +X-Sequence-Number: 13456 + +"Jeffrey W. Baker" writes: +> On Fri, 2005-07-15 at 00:00 -0700, Karim Nassar wrote: +>> I am working on a system that uses postgresql 7.4.2 (can't change that +>> until 8.1 goes stable). Just figured out that there are about 285,000 +>> connections created over about 11 hours every day. That averages out to +>> about 7.2 connections per second. +>> +>> Is that a lot? I've never seen that many. + +> I see about 8 million connections per full day. Connecting to postgres +> is cheap. + +It's not *that* cheap. I think you'd get materially better performance +if you managed to pool your connections a bit. By the time a backend +has started, initialized itself, joined a database, and populated its +internal caches with enough catalog entries to get useful work done, +you've got a fair number of cycles invested in it. Dropping the backend +after only one or two queries is just not going to be efficient. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jul 15 12:10:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 543E352B75 + for ; + Fri, 15 Jul 2005 12:10:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68667-05 + for ; + Fri, 15 Jul 2005 15:09:52 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 34E0E52B22 + for ; + Fri, 15 Jul 2005 12:09:50 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id E22A1644140 + for ; + Fri, 15 Jul 2005 09:09:25 -0600 (MDT) +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 20037-01 for ; + Fri, 15 Jul 2005 09:09:23 -0600 (MDT) +Received: from [192.168.1.12] (c-24-9-24-35.hsd1.co.comcast.net [24.9.24.35]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id BD35364411F + for ; + Fri, 15 Jul 2005 09:09:23 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +In-Reply-To: <42D7379F.3040806@arbash-meinel.com> +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + + <42D6F177.3000002@arbash-meinel.com> + + <42D70E42.90403@arbash-meinel.com> + + <42D7379F.3040806@arbash-meinel.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +From: Dan Harris +Subject: Re: slow joining very large table to smaller ones +Date: Fri, 15 Jul 2005 09:09:37 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/216 +X-Sequence-Number: 13457 + + +On Jul 14, 2005, at 10:12 PM, John A Meinel wrote: +> +> My biggest question is why the planner things the Nested Loop would be +> so expensive. +> Have you tuned any of the parameters? It seems like something is +> out of +> whack. (cpu_tuple_cost, random_page_cost, etc...) +> + +here's some of my postgresql.conf. Feel free to blast me if I did +something idiotic here. + +shared_buffers = 50000 +effective_cache_size = 1348000 +random_page_cost = 3 +work_mem = 512000 +max_fsm_pages = 80000 +log_min_duration_statement = 60000 +fsync = true ( not sure if I'm daring enough to run without this ) +wal_buffers = 1000 +checkpoint_segments = 64 +checkpoint_timeout = 3000 + + +#---- FOR PG_AUTOVACUUM --# +stats_command_string = true +stats_row_level = true + + +From pgsql-performance-owner@postgresql.org Fri Jul 15 12:21:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 871FF528DD + for ; + Fri, 15 Jul 2005 12:21:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69883-05 + for ; + Fri, 15 Jul 2005 15:21:44 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id CDBD552849 + for ; + Fri, 15 Jul 2005 12:21:43 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id 6A33E6441FF + for ; + Fri, 15 Jul 2005 09:21:19 -0600 (MDT) +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 20274-09 for ; + Fri, 15 Jul 2005 09:21:16 -0600 (MDT) +Received: from [192.168.1.12] (c-24-9-24-35.hsd1.co.comcast.net [24.9.24.35]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id 7A8E1644202 + for ; + Fri, 15 Jul 2005 09:21:16 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +In-Reply-To: +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + + <42D6F177.3000002@arbash-meinel.com> + + <42D70E42.90403@arbash-meinel.com> + + <42D7379F.3040806@arbash-meinel.com> + +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +From: Dan Harris +Subject: Re: slow joining very large table to smaller ones +Date: Fri, 15 Jul 2005 09:21:31 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/217 +X-Sequence-Number: 13458 + + +On Jul 15, 2005, at 9:09 AM, Dan Harris wrote: + +> +> On Jul 14, 2005, at 10:12 PM, John A Meinel wrote: +> +>> +>> My biggest question is why the planner things the Nested Loop +>> would be +>> so expensive. +>> Have you tuned any of the parameters? It seems like something is +>> out of +>> whack. (cpu_tuple_cost, random_page_cost, etc...) +>> +>> +> +> here's some of my postgresql.conf. Feel free to blast me if I did +> something idiotic here. +> +> shared_buffers = 50000 +> effective_cache_size = 1348000 +> random_page_cost = 3 +> work_mem = 512000 +> max_fsm_pages = 80000 +> log_min_duration_statement = 60000 +> fsync = true ( not sure if I'm daring enough to run without this ) +> wal_buffers = 1000 +> checkpoint_segments = 64 +> checkpoint_timeout = 3000 +> +> +> #---- FOR PG_AUTOVACUUM --# +> stats_command_string = true +> stats_row_level = true +> + +Sorry, I forgot to re-post my hardware specs. + +HP DL585 +4 x 2.2 GHz Opteron +12GB RAM +SmartArray RAID controller, 1GB hardware cache, 4x73GB 10k SCSI in +RAID 0+1 +ext2 filesystem + +Also, there are 30 databases on the machine, 27 of them are identical +schemas. + + +From pgsql-performance-owner@postgresql.org Fri Jul 15 13:03:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E3F6052913 + for ; + Fri, 15 Jul 2005 13:03:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79139-08 + for ; + Fri, 15 Jul 2005 16:03:15 +0000 (GMT) +Received: from lakermmtao03.cox.net (lakermmtao03.cox.net [68.230.240.36]) + by svr1.postgresql.org (Postfix) with ESMTP id A6FC4528DD + for ; + Fri, 15 Jul 2005 13:03:11 -0300 (ADT) +Received: from [127.0.0.1] (really [68.3.22.74]) by lakermmtao03.cox.net + (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP + id <20050715160310.LTGV23050.lakermmtao03.cox.net@[127.0.0.1]>; + Fri, 15 Jul 2005 12:03:10 -0400 +Message-ID: <42D7DE40.3070507@works4me.com> +Date: Fri, 15 Jul 2005 09:03:12 -0700 +From: Dennis +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: David Mitchell +Cc: Qingqing Zhou , + pgsql-performance@postgresql.org +Subject: Re: performance problems ... 100 cpu utilization +References: <42D567DB.6000100@works4me.com> + <42D5DBEB.4010503@works4me.com> <42D5F315.3090301@telogis.com> + <42D60C2E.3020004@works4me.com> <42D7069B.5090107@telogis.com> +In-Reply-To: <42D7069B.5090107@telogis.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Antivirus: avast! (VPS 0528-5, 07/15/2005), Outbound message +X-Antivirus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/218 +X-Sequence-Number: 13459 + +David Mitchell wrote: + +> If your table has got into this state, then vacuum analyze won't fix +> it. You will have to do a vacuum full to get it back to normal, then +> regularly vacuum (not full) to keep it in good condition. We vacuum +> our critical tables every 10 minutes to keep them in good nick. + + +So should I have vacuum run during the load test? At what level of +updates should it run every ten minutes? + +Dennis + +From pgsql-performance-owner@postgresql.org Fri Jul 15 13:44:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 499D552ADF + for ; + Fri, 15 Jul 2005 13:44:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12499-02 + for ; + Fri, 15 Jul 2005 16:44:32 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.197.194]) + by svr1.postgresql.org (Postfix) with SMTP id B6B50528DD + for ; + Fri, 15 Jul 2005 13:44:28 -0300 (ADT) +Received: (qmail 783 invoked by uid 500); 15 Jul 2005 16:44:58 -0000 +Date: Fri, 15 Jul 2005 11:44:58 -0500 +From: Bruno Wolff III +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: slow joining very large table to smaller ones +Message-ID: <20050715164458.GA26178@wolff.to> +Mail-Followup-To: Bruno Wolff III , + Dan Harris , pgsql-performance@postgresql.org +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/219 +X-Sequence-Number: 13460 + +On Thu, Jul 14, 2005 at 16:29:58 -0600, + Dan Harris wrote: +> +> Ok, I tried this one. My ssh keeps getting cut off by a router +> somewhere between me and the server due to inactivity timeouts, so +> all I know is that both the select and explain analyze are taking +> over an hour to run. Here's the explain select for that one, since +> that's the best I can get. + +Are you using NAT at home? That's probably where the issue is. If you +have control of that box you can probably increase the timeout to a +couple of hours. + +From pgsql-performance-owner@postgresql.org Fri Jul 15 14:39:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2595752BE9 + for ; + Fri, 15 Jul 2005 14:39:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73174-05 + for ; + Fri, 15 Jul 2005 17:39:35 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id E8F3252B13 + for ; + Fri, 15 Jul 2005 14:39:34 -0300 (ADT) +Received: (qmail 25483 invoked from network); 15 Jul 2005 19:40:05 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 15 Jul 2005 19:40:05 +0200 +To: "Bruno Wolff III" , + "Dan Harris" +Cc: pgsql-performance@postgresql.org +Subject: Re: slow joining very large table to smaller ones +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + + <20050715164458.GA26178@wolff.to> +Message-ID: +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Date: Fri, 15 Jul 2005 19:39:30 +0200 +In-Reply-To: <20050715164458.GA26178@wolff.to> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/220 +X-Sequence-Number: 13461 + + +>> Ok, I tried this one. My ssh keeps getting cut off by a router +>> somewhere between me and the server due to inactivity timeouts, so +>> all I know is that both the select and explain analyze are taking +>> over an hour to run. Here's the explain select for that one, since +>> that's the best I can get. + + one word : screen ! + one of the most useful little command line utilities... + +From pgsql-performance-owner@postgresql.org Fri Jul 15 17:39:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3BFDC52971 + for ; + Fri, 15 Jul 2005 17:39:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38860-01 + for ; + Fri, 15 Jul 2005 20:39:47 +0000 (GMT) +Received: from betsy.gw.rwsoft.ca (S01060080c8fe76dd.ed.shawcable.net + [68.150.80.101]) + by svr1.postgresql.org (Postfix) with ESMTP id AEE0752932 + for ; + Fri, 15 Jul 2005 17:39:45 -0300 (ADT) +Received: from deva.gw.rwsoft.ca (unknown [192.168.34.107]) + by betsy.gw.rwsoft.ca (Postfix) with ESMTP id D7C66CFBA + for ; + Fri, 15 Jul 2005 14:39:45 -0600 (MDT) +Date: Fri, 15 Jul 2005 14:39:36 -0600 +Message-ID: <8764vbby7r.wl%ron@rwsoft.ca> +From: Ron Wills +To: pgsql-performance@postgresql.org +Subject: Really bad diskio +User-Agent: Wanderlust/2.12.2 (99 Luftballons) SEMI/1.14.6 (Maruoka) + FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.4 + (i586-pc-linux-gnu) MULE/5.0 (SAKAKI) +MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.187 tagged_above=0 required=5 + tests=FORGED_RCVD_HELO, RCVD_IN_SORBS_DUL +X-Spam-Level: +X-Archive-Number: 200507/221 +X-Sequence-Number: 13462 + +Hello all + + I'm running a postgres 7.4.5, on a dual 2.4Ghz Athlon, 1Gig RAM and +an 3Ware SATA raid. Currently the database is only 16G with about 2 +tables with 500000+ row, one table 200000+ row and a few small +tables. The larger tables get updated about every two hours. The +problem I having with this server (which is in production) is the disk +IO. On the larger tables I'm getting disk IO wait averages of +~70-90%. I've been tweaking the linux kernel as specified in the +PostgreSQL documentations and switched to the deadline +scheduler. Nothing seems to be fixing this. The queries are as +optimized as I can get them. fsync is off in an attempt to help +preformance still nothing. Are there any setting I should be look at +the could improve on this??? + +Thanks for and help in advance. + +Ron + +From pgsql-performance-owner@postgresql.org Fri Jul 15 17:45:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6112A5281E + for ; + Fri, 15 Jul 2005 17:45:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38609-03 + for ; + Fri, 15 Jul 2005 20:45:06 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 3128852AF8 + for ; + Fri, 15 Jul 2005 17:45:06 -0300 (ADT) +Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j6FKj8hr002927; Fri, 15 Jul 2005 13:45:08 -0700 +Message-ID: <42D82053.1090309@commandprompt.com> +Date: Fri, 15 Jul 2005 13:45:07 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Ron Wills +Cc: pgsql-performance@postgresql.org +Subject: Re: Really bad diskio +References: <8764vbby7r.wl%ron@rwsoft.ca> +In-Reply-To: <8764vbby7r.wl%ron@rwsoft.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, hits=0.014 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/222 +X-Sequence-Number: 13463 + +Ron Wills wrote: +> Hello all +> +> I'm running a postgres 7.4.5, on a dual 2.4Ghz Athlon, 1Gig RAM and +> an 3Ware SATA raid. + +2 drives? +4 drives? +8 drives? + +RAID 1? 0? 10? 5? + + +Currently the database is only 16G with about 2 +> tables with 500000+ row, one table 200000+ row and a few small +> tables. The larger tables get updated about every two hours. The +> problem I having with this server (which is in production) is the disk +> IO. On the larger tables I'm getting disk IO wait averages of +> ~70-90%. I've been tweaking the linux kernel as specified in the +> PostgreSQL documentations and switched to the deadline +> scheduler. Nothing seems to be fixing this. The queries are as +> optimized as I can get them. fsync is off in an attempt to help +> preformance still nothing. Are there any setting I should be look at +> the could improve on this??? +> +> Thanks for and help in advance. +> +> Ron +> +> ---------------------------(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 + + +-- +Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 +PostgreSQL Replication, Consulting, Custom Programming, 24x7 support +Managed Services, Shared and Dedicated Hosting +Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ + +From pgsql-performance-owner@postgresql.org Fri Jul 15 18:01:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EDD9C52A76 + for ; + Fri, 15 Jul 2005 18:01:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42725-02 + for ; + Fri, 15 Jul 2005 21:01:30 +0000 (GMT) +Received: from gghcwest.com (adsl-71-128-90-172.dsl.pltn13.pacbell.net + [71.128.90.172]) + by svr1.postgresql.org (Postfix) with ESMTP id C5F2452971 + for ; + Fri, 15 Jul 2005 18:01:28 -0300 (ADT) +Received: from toonses.gghcwest.com (toonses.gghcwest.com [192.168.168.115]) + by gghcwest.com (8.12.10/8.12.9) with ESMTP id j6FL1Qmd013303; + Fri, 15 Jul 2005 14:01:27 -0700 +Received: from jwb by toonses.gghcwest.com with local (Exim 4.50) + id 1DtXHz-0007dA-VK; Fri, 15 Jul 2005 14:00:07 -0700 +Subject: Re: Really bad diskio +From: "Jeffrey W. Baker" +To: Ron Wills +Cc: pgsql-performance@postgresql.org +In-Reply-To: <8764vbby7r.wl%ron@rwsoft.ca> +References: <8764vbby7r.wl%ron@rwsoft.ca> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Date: Fri, 15 Jul 2005 14:00:07 -0700 +Message-Id: <1121461207.28449.8.camel@toonses.gghcwest.com> +Mime-Version: 1.0 +X-Mailer: Evolution 2.3.4 +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200507/223 +X-Sequence-Number: 13464 + +On Fri, 2005-07-15 at 14:39 -0600, Ron Wills wrote: +> Hello all +> +> I'm running a postgres 7.4.5, on a dual 2.4Ghz Athlon, 1Gig RAM and +> an 3Ware SATA raid. Currently the database is only 16G with about 2 +> tables with 500000+ row, one table 200000+ row and a few small +> tables. The larger tables get updated about every two hours. The +> problem I having with this server (which is in production) is the disk +> IO. On the larger tables I'm getting disk IO wait averages of +> ~70-90%. I've been tweaking the linux kernel as specified in the +> PostgreSQL documentations and switched to the deadline +> scheduler. Nothing seems to be fixing this. The queries are as +> optimized as I can get them. fsync is off in an attempt to help +> preformance still nothing. Are there any setting I should be look at +> the could improve on this??? + +Can you please characterize this a bit better? Send the output of +vmstat or iostat over several minutes, or similar diagnostic +information. + +Also please describe your hardware more. + +Regards, +Jeff Baker + +From pgsql-performance-owner@postgresql.org Fri Jul 15 18:04:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8BCF152B5C + for ; + Fri, 15 Jul 2005 18:04:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39580-08 + for ; + Fri, 15 Jul 2005 21:04:46 +0000 (GMT) +Received: from betsy.gw.rwsoft.ca (S01060080c8fe76dd.ed.shawcable.net + [68.150.80.101]) + by svr1.postgresql.org (Postfix) with ESMTP id EABF952971 + for ; + Fri, 15 Jul 2005 18:04:44 -0300 (ADT) +Received: from deva.gw.rwsoft.ca (unknown [192.168.34.107]) + by betsy.gw.rwsoft.ca (Postfix) with ESMTP id 2FF0ECDD7; + Fri, 15 Jul 2005 15:04:46 -0600 (MDT) +Date: Fri, 15 Jul 2005 15:04:35 -0600 +Message-ID: <874qavbx24.wl%ron@rwsoft.ca> +From: Ron Wills +To: "Joshua D. Drake" +Cc: Ron Wills , pgsql-performance@postgresql.org +Subject: Re: Really bad diskio +In-Reply-To: <42D82053.1090309@commandprompt.com> +References: <8764vbby7r.wl%ron@rwsoft.ca> <42D82053.1090309@commandprompt.com> +User-Agent: Wanderlust/2.12.2 (99 Luftballons) SEMI/1.14.6 (Maruoka) + FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.4 + (i586-pc-linux-gnu) MULE/5.0 (SAKAKI) +MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.153 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_IN_SORBS_DUL +X-Spam-Level: +X-Archive-Number: 200507/224 +X-Sequence-Number: 13465 + +At Fri, 15 Jul 2005 13:45:07 -0700, +Joshua D. Drake wrote: +> +> Ron Wills wrote: +> > Hello all +> > +> > I'm running a postgres 7.4.5, on a dual 2.4Ghz Athlon, 1Gig RAM and +> > an 3Ware SATA raid. +> +> 2 drives? +> 4 drives? +> 8 drives? + + 3 drives raid 5. I don't believe it's the raid. I've tested this by +moving the database to the mirrors software raid where the root is +found and onto the the SATA raid. Neither relieved the IO problems. + I was also was thinking this could be from the transactional +subsystem getting overloaded? There are several automated processes +that use the DB. Most are just selects, but the data updates and one +that updates the smaller tables that are the heavier queries. On +their own they seem to work ok, (still high IO, but fairly quick). But +if even the simplest select is called during the heavier operation, +then everything goes out through the roof. Maybe there's something I'm +missing here as well? + +> RAID 1? 0? 10? 5? +> +> +> Currently the database is only 16G with about 2 +> > tables with 500000+ row, one table 200000+ row and a few small +> > tables. The larger tables get updated about every two hours. The +> > problem I having with this server (which is in production) is the disk +> > IO. On the larger tables I'm getting disk IO wait averages of +> > ~70-90%. I've been tweaking the linux kernel as specified in the +> > PostgreSQL documentations and switched to the deadline +> > scheduler. Nothing seems to be fixing this. The queries are as +> > optimized as I can get them. fsync is off in an attempt to help +> > preformance still nothing. Are there any setting I should be look at +> > the could improve on this??? +> > +> > Thanks for and help in advance. +> > +> > Ron +> > +> > ---------------------------(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 +> +> +> -- +> Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 +> PostgreSQL Replication, Consulting, Custom Programming, 24x7 support +> Managed Services, Shared and Dedicated Hosting +> Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ + +From pgsql-performance-owner@postgresql.org Fri Jul 15 18:07:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2320B52815 + for ; + Fri, 15 Jul 2005 18:07:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42241-03 + for ; + Fri, 15 Jul 2005 21:07:20 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id D7E1852A76 + for ; + Fri, 15 Jul 2005 18:07:16 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id B95666441A1 + for ; + Fri, 15 Jul 2005 15:06:54 -0600 (MDT) +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 23968-08 for ; + Fri, 15 Jul 2005 15:06:52 -0600 (MDT) +Received: from [192.168.1.12] (c-24-9-24-35.hsd1.co.comcast.net [24.9.24.35]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id C46F8644181 + for ; + Fri, 15 Jul 2005 15:06:52 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +In-Reply-To: <8764vbby7r.wl%ron@rwsoft.ca> +References: <8764vbby7r.wl%ron@rwsoft.ca> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <977B093F-E2FC-4A7C-89E5-5715D07873C2@drivefaster.net> +Content-Transfer-Encoding: 7bit +From: Dan Harris +Subject: Re: Really bad diskio +Date: Fri, 15 Jul 2005 15:07:08 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/225 +X-Sequence-Number: 13466 + + +On Jul 15, 2005, at 2:39 PM, Ron Wills wrote: + +> Hello all +> +> I'm running a postgres 7.4.5, on a dual 2.4Ghz Athlon, 1Gig RAM and +> an 3Ware SATA raid. + +Operating System? Which file system are you using? I was having a +similar problem just a few days ago and learned that ext3 was the +culprit. + +-Dan + +From pgsql-performance-owner@postgresql.org Fri Jul 15 18:10:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CA94152CB3 + for ; + Fri, 15 Jul 2005 18:10:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42809-04 + for ; + Fri, 15 Jul 2005 21:10:17 +0000 (GMT) +Received: from mr1.surnet.cl (smtp1.surnet.cl [216.155.73.162]) + by svr1.postgresql.org (Postfix) with ESMTP id 2728652862 + for ; + Fri, 15 Jul 2005 18:10:16 -0300 (ADT) +Received: from smtp1.surnet.cl (216.155.73.168) by mr1.surnet.cl (7.0.031.3) + id 42587EDE015BAB24; Fri, 15 Jul 2005 17:09:39 -0400 +Received: from smtp2.surnet.cl (smtp2.surnet.cl []) + by mr1.surnet.cl ([216.155.73.168]); Fri, 15 Jul 2005 21:09:39 +0000 +Received: from cluster.surnet.cl (216.155.73.164) by smtp2.surnet.cl + (7.0.031.3) id 4259ADE300D53D78; Fri, 15 Jul 2005 17:09:58 -0400 +Received: from alvh.no-ip.org (200.85.218.66) by cluster.surnet.cl (7.0.043) + (authenticated as alvherre@surnet.cl) + id 42B3EF60003F14F7; Fri, 15 Jul 2005 17:10:15 -0400 +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id B39FCC3711D; Fri, 15 Jul 2005 17:10:26 -0400 (CLT) +Date: Fri, 15 Jul 2005 17:10:26 -0400 +From: Alvaro Herrera +To: Ron Wills +Cc: "Joshua D. Drake" , pgsql-performance@postgresql.org +Subject: Re: Really bad diskio +Message-ID: <20050715211026.GA30540@alvh.no-ip.org> +References: <8764vbby7r.wl%ron@rwsoft.ca> <42D82053.1090309@commandprompt.com> + <874qavbx24.wl%ron@rwsoft.ca> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <874qavbx24.wl%ron@rwsoft.ca> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.382 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, RCVD_IN_NJABL_PROXY +X-Spam-Level: * +X-Archive-Number: 200507/226 +X-Sequence-Number: 13467 + +On Fri, Jul 15, 2005 at 03:04:35PM -0600, Ron Wills wrote: +> +> > Ron Wills wrote: +> > > Hello all +> > > +> > > I'm running a postgres 7.4.5, on a dual 2.4Ghz Athlon, 1Gig RAM and +> > > an 3Ware SATA raid. +> > +> 3 drives raid 5. I don't believe it's the raid. I've tested this by +> moving the database to the mirrors software raid where the root is +> found and onto the the SATA raid. Neither relieved the IO problems. + +What filesystem is this? + +-- +Alvaro Herrera () +Si no sabes adonde vas, es muy probable que acabes en otra parte. + +From pgsql-performance-owner@postgresql.org Fri Jul 15 18:18:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C589552CB4 + for ; + Fri, 15 Jul 2005 18:18:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42126-10 + for ; + Fri, 15 Jul 2005 21:18:55 +0000 (GMT) +Received: from gghcwest.com (adsl-71-128-90-172.dsl.pltn13.pacbell.net + [71.128.90.172]) + by svr1.postgresql.org (Postfix) with ESMTP id 173AE52CAE + for ; + Fri, 15 Jul 2005 18:18:54 -0300 (ADT) +Received: from toonses.gghcwest.com (toonses.gghcwest.com [192.168.168.115]) + by gghcwest.com (8.12.10/8.12.9) with ESMTP id j6FLIrmd026100; + Fri, 15 Jul 2005 14:18:53 -0700 +Received: from jwb by toonses.gghcwest.com with local (Exim 4.50) + id 1DtXYt-0007eo-26; Fri, 15 Jul 2005 14:17:35 -0700 +Subject: Re: Really bad diskio +From: "Jeffrey W. Baker" +To: Ron Wills +Cc: pgsql-performance@postgresql.org +In-Reply-To: <874qavbx24.wl%ron@rwsoft.ca> +References: <8764vbby7r.wl%ron@rwsoft.ca> + <42D82053.1090309@commandprompt.com> <874qavbx24.wl%ron@rwsoft.ca> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Date: Fri, 15 Jul 2005 14:17:34 -0700 +Message-Id: <1121462254.29379.3.camel@toonses.gghcwest.com> +Mime-Version: 1.0 +X-Mailer: Evolution 2.3.4 +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200507/227 +X-Sequence-Number: 13468 + +On Fri, 2005-07-15 at 15:04 -0600, Ron Wills wrote: +> At Fri, 15 Jul 2005 13:45:07 -0700, +> Joshua D. Drake wrote: +> > +> > Ron Wills wrote: +> > > Hello all +> > > +> > > I'm running a postgres 7.4.5, on a dual 2.4Ghz Athlon, 1Gig RAM and +> > > an 3Ware SATA raid. +> > +> > 2 drives? +> > 4 drives? +> > 8 drives? +> +> 3 drives raid 5. I don't believe it's the raid. I've tested this by +> moving the database to the mirrors software raid where the root is +> found and onto the the SATA raid. Neither relieved the IO problems. + +Hard or soft RAID? Which controller? Many of the 3Ware controllers +(85xx and 95xx) have extremely bad RAID 5 performance. + +Did you take any pgbench or other benchmark figures before you started +using the DB? + +-jwb + +From pgsql-performance-owner@postgresql.org Fri Jul 15 18:29:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F17F352918 + for ; + Fri, 15 Jul 2005 18:29:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42727-09 + for ; + Fri, 15 Jul 2005 21:29:15 +0000 (GMT) +Received: from betsy.gw.rwsoft.ca (S01060080c8fe76dd.ed.shawcable.net + [68.150.80.101]) + by svr1.postgresql.org (Postfix) with ESMTP id AB94252B88 + for ; + Fri, 15 Jul 2005 18:29:14 -0300 (ADT) +Received: from deva.gw.rwsoft.ca (unknown [192.168.34.107]) + by betsy.gw.rwsoft.ca (Postfix) with ESMTP id 1137ACDD7; + Fri, 15 Jul 2005 15:29:16 -0600 (MDT) +Date: Fri, 15 Jul 2005 15:29:06 -0600 +Message-ID: <873bqfbvx9.wl%ron@rwsoft.ca> +From: Ron Wills +To: "Jeffrey W. Baker" +Cc: Ron Wills , pgsql-performance@postgresql.org +Subject: Re: Really bad diskio +In-Reply-To: <1121461207.28449.8.camel@toonses.gghcwest.com> +References: <8764vbby7r.wl%ron@rwsoft.ca> + <1121461207.28449.8.camel@toonses.gghcwest.com> +User-Agent: Wanderlust/2.12.2 (99 Luftballons) SEMI/1.14.6 (Maruoka) + FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.4 + (i586-pc-linux-gnu) MULE/5.0 (SAKAKI) +MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.153 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_IN_SORBS_DUL +X-Spam-Level: +X-Archive-Number: 200507/228 +X-Sequence-Number: 13469 + +At Fri, 15 Jul 2005 14:00:07 -0700, +Jeffrey W. Baker wrote: +> +> On Fri, 2005-07-15 at 14:39 -0600, Ron Wills wrote: +> > Hello all +> > +> > I'm running a postgres 7.4.5, on a dual 2.4Ghz Athlon, 1Gig RAM and +> > an 3Ware SATA raid. Currently the database is only 16G with about 2 +> > tables with 500000+ row, one table 200000+ row and a few small +> > tables. The larger tables get updated about every two hours. The +> > problem I having with this server (which is in production) is the disk +> > IO. On the larger tables I'm getting disk IO wait averages of +> > ~70-90%. I've been tweaking the linux kernel as specified in the +> > PostgreSQL documentations and switched to the deadline +> > scheduler. Nothing seems to be fixing this. The queries are as +> > optimized as I can get them. fsync is off in an attempt to help +> > preformance still nothing. Are there any setting I should be look at +> > the could improve on this??? +> +> Can you please characterize this a bit better? Send the output of +> vmstat or iostat over several minutes, or similar diagnostic +> information. +> +> Also please describe your hardware more. + +Here's a bit of a dump of the system that should be useful. + +Processors x2: + +vendor_id : AuthenticAMD +cpu family : 6 +model : 8 +model name : AMD Athlon(tm) MP 2400+ +stepping : 1 +cpu MHz : 2000.474 +cache size : 256 KB + +MemTotal: 903804 kB + +Mandrake 10.0 Linux kernel 2.6.3-19mdk + +The raid controller, which is using the hardware raid configuration: + +3ware 9000 Storage Controller device driver for Linux v2.26.02.001. +scsi0 : 3ware 9000 Storage Controller +3w-9xxx: scsi0: Found a 3ware 9000 Storage Controller at 0xe8020000, IRQ: 17. +3w-9xxx: scsi0: Firmware FE9X 2.02.00.011, BIOS BE9X 2.02.01.037, Ports: 4. + Vendor: 3ware Model: Logical Disk 00 Rev: 1.00 + Type: Direct-Access ANSI SCSI revision: 00 +SCSI device sda: 624955392 512-byte hdwr sectors (319977 MB) +SCSI device sda: drive cache: write back, no read (daft) + +This is also on a 3.6 reiser filesystem. + +Here's the iostat for 10mins every 10secs. I've removed the stats from +the idle drives to reduce the size of this email. + +Linux 2.6.3-19mdksmp (photo_server) 07/15/2005 + +avg-cpu: %user %nice %sys %iowait %idle + 2.85 1.53 2.15 39.52 53.95 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 82.49 4501.73 188.38 1818836580 76110154 + +avg-cpu: %user %nice %sys %iowait %idle + 0.30 0.00 1.00 96.30 2.40 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 87.80 6159.20 340.00 61592 3400 + +avg-cpu: %user %nice %sys %iowait %idle + 2.50 0.00 1.45 94.35 1.70 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 89.60 5402.40 320.80 54024 3208 + +avg-cpu: %user %nice %sys %iowait %idle + 1.00 0.10 1.35 97.55 0.00 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 105.20 5626.40 332.80 56264 3328 + +avg-cpu: %user %nice %sys %iowait %idle + 0.40 0.00 1.00 87.40 11.20 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 92.61 4484.32 515.48 44888 5160 + +avg-cpu: %user %nice %sys %iowait %idle + 0.45 0.00 1.00 92.66 5.89 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 89.10 4596.00 225.60 45960 2256 + +avg-cpu: %user %nice %sys %iowait %idle + 0.30 0.00 0.80 96.30 2.60 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 86.49 3877.48 414.01 38736 4136 + +avg-cpu: %user %nice %sys %iowait %idle + 0.50 0.00 1.00 98.15 0.35 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 97.10 4710.49 405.19 47152 4056 + +avg-cpu: %user %nice %sys %iowait %idle + 0.35 0.00 1.00 98.65 0.00 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 93.30 5324.80 186.40 53248 1864 + +avg-cpu: %user %nice %sys %iowait %idle + 0.40 0.00 1.10 96.70 1.80 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 117.88 5481.72 402.80 54872 4032 + +avg-cpu: %user %nice %sys %iowait %idle + 0.50 0.00 1.05 98.30 0.15 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 124.00 6081.60 403.20 60816 4032 + +avg-cpu: %user %nice %sys %iowait %idle + 8.75 0.00 2.55 84.46 4.25 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 125.20 5609.60 228.80 56096 2288 + +avg-cpu: %user %nice %sys %iowait %idle + 2.25 0.00 1.30 96.00 0.45 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 176.98 6166.17 686.29 61600 6856 + +avg-cpu: %user %nice %sys %iowait %idle + 5.95 0.00 2.25 88.09 3.70 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 154.55 7879.32 295.70 78872 2960 + +avg-cpu: %user %nice %sys %iowait %idle + 10.29 0.00 3.40 81.97 4.35 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 213.19 11422.18 557.84 114336 5584 + +avg-cpu: %user %nice %sys %iowait %idle + 1.90 0.10 3.25 94.75 0.00 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 227.80 12330.40 212.80 123304 2128 + +avg-cpu: %user %nice %sys %iowait %idle + 0.55 0.00 0.85 96.80 1.80 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 96.30 3464.80 568.80 34648 5688 + +avg-cpu: %user %nice %sys %iowait %idle + 0.70 0.00 1.10 97.25 0.95 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 92.60 4989.60 237.60 49896 2376 + +avg-cpu: %user %nice %sys %iowait %idle + 2.75 0.00 2.10 93.55 1.60 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 198.40 10031.63 458.86 100216 4584 + +avg-cpu: %user %nice %sys %iowait %idle + 0.65 0.00 2.40 95.90 1.05 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 250.25 14174.63 231.77 141888 2320 + +avg-cpu: %user %nice %sys %iowait %idle + 0.60 0.00 2.15 97.20 0.05 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 285.50 12127.20 423.20 121272 4232 + +avg-cpu: %user %nice %sys %iowait %idle + 0.60 0.00 2.90 95.65 0.85 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 393.70 14383.20 534.40 143832 5344 + +avg-cpu: %user %nice %sys %iowait %idle + 0.55 0.00 2.15 96.15 1.15 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 252.15 11801.80 246.15 118136 2464 + +avg-cpu: %user %nice %sys %iowait %idle + 0.75 0.00 3.45 95.15 0.65 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 396.00 19980.80 261.60 199808 2616 + +avg-cpu: %user %nice %sys %iowait %idle + 0.70 0.00 2.70 95.70 0.90 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 286.20 14182.40 467.20 141824 4672 + +avg-cpu: %user %nice %sys %iowait %idle + 0.70 0.00 2.70 95.65 0.95 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 344.20 15838.40 473.60 158384 4736 + +avg-cpu: %user %nice %sys %iowait %idle + 0.75 0.00 1.70 97.50 0.05 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 178.72 7495.70 412.39 75032 4128 + +avg-cpu: %user %nice %sys %iowait %idle + 1.05 0.05 1.30 97.05 0.55 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 107.89 4334.87 249.35 43392 2496 + +avg-cpu: %user %nice %sys %iowait %idle + 0.55 0.00 1.30 98.10 0.05 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 107.01 6345.55 321.12 63392 3208 + +avg-cpu: %user %nice %sys %iowait %idle + 0.65 0.00 1.05 97.55 0.75 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 107.79 3908.89 464.34 39128 4648 + +avg-cpu: %user %nice %sys %iowait %idle + 0.50 0.00 1.15 97.75 0.60 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 109.21 4162.56 434.83 41584 4344 + +avg-cpu: %user %nice %sys %iowait %idle + 0.75 0.00 1.15 98.00 0.10 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 104.19 4796.81 211.58 48064 2120 + +avg-cpu: %user %nice %sys %iowait %idle + 0.70 0.00 1.05 97.85 0.40 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 105.50 4690.40 429.60 46904 4296 + +avg-cpu: %user %nice %sys %iowait %idle + 0.75 0.00 1.10 98.15 0.00 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 107.51 4525.33 357.96 45208 3576 + +avg-cpu: %user %nice %sys %iowait %idle + 2.80 0.00 1.65 92.81 2.75 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 123.18 3810.59 512.29 38144 5128 + +avg-cpu: %user %nice %sys %iowait %idle + 0.60 0.00 1.05 97.10 1.25 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 104.60 3780.00 236.00 37800 2360 + +avg-cpu: %user %nice %sys %iowait %idle + 0.70 0.00 1.10 95.96 2.25 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 117.08 3817.78 466.73 38216 4672 + +avg-cpu: %user %nice %sys %iowait %idle + 0.65 0.00 0.90 96.65 1.80 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 117.20 3629.60 477.60 36296 4776 + +avg-cpu: %user %nice %sys %iowait %idle + 0.80 0.00 1.10 97.50 0.60 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 112.79 4258.94 326.07 42632 3264 + +avg-cpu: %user %nice %sys %iowait %idle + 1.05 0.15 1.20 97.50 0.10 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 125.83 2592.99 522.12 25904 5216 + + +avg-cpu: %user %nice %sys %iowait %idle + 0.60 0.00 0.55 98.20 0.65 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 104.90 823.98 305.29 8248 3056 + +avg-cpu: %user %nice %sys %iowait %idle + 0.50 0.00 0.65 98.75 0.10 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 109.80 734.40 468.80 7344 4688 + +avg-cpu: %user %nice %sys %iowait %idle + 1.15 0.00 1.05 97.75 0.05 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 107.70 751.20 463.20 7512 4632 + +avg-cpu: %user %nice %sys %iowait %idle + 6.50 0.00 1.85 90.25 1.40 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 98.00 739.14 277.08 7384 2768 + +avg-cpu: %user %nice %sys %iowait %idle + 0.20 0.00 0.40 82.75 16.65 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 83.13 550.90 360.08 5520 3608 + +avg-cpu: %user %nice %sys %iowait %idle + 2.65 0.30 2.15 82.91 11.99 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 100.00 1136.46 503.50 11376 5040 + +avg-cpu: %user %nice %sys %iowait %idle + 1.00 6.25 2.15 89.70 0.90 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 170.17 4106.51 388.39 41024 3880 + +avg-cpu: %user %nice %sys %iowait %idle + 0.75 0.15 1.75 73.70 23.65 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 234.60 5107.20 232.80 51072 2328 + +avg-cpu: %user %nice %sys %iowait %idle + 0.15 0.00 0.65 49.48 49.73 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 175.52 1431.37 122.28 14328 1224 + +avg-cpu: %user %nice %sys %iowait %idle + 0.15 0.00 0.55 50.22 49.08 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 173.50 1464.00 119.20 14640 1192 + +avg-cpu: %user %nice %sys %iowait %idle + 2.00 0.00 0.60 76.18 21.22 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 130.60 1044.80 203.20 10448 2032 + +avg-cpu: %user %nice %sys %iowait %idle + 0.90 0.10 0.75 97.55 0.70 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 92.09 1024.22 197.80 10232 1976 + +avg-cpu: %user %nice %sys %iowait %idle + 0.25 0.00 0.40 73.78 25.57 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 92.81 582.83 506.99 5840 5080 + +avg-cpu: %user %nice %sys %iowait %idle + 0.20 0.00 0.55 98.85 0.40 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 90.80 657.60 383.20 6576 3832 + +avg-cpu: %user %nice %sys %iowait %idle + 16.46 0.00 4.25 77.09 2.20 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 99.60 1174.83 549.85 11760 5504 + +avg-cpu: %user %nice %sys %iowait %idle + 8.05 0.00 2.60 56.92 32.43 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 172.30 2063.20 128.00 20632 1280 + +avg-cpu: %user %nice %sys %iowait %idle + 20.84 0.00 4.75 52.82 21.59 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 174.30 1416.80 484.00 14168 4840 + +avg-cpu: %user %nice %sys %iowait %idle + 1.30 0.00 1.60 56.93 40.17 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 181.02 2858.74 418.78 28616 4192 + +avg-cpu: %user %nice %sys %iowait %idle + 19.17 0.00 4.44 49.78 26.61 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 162.20 1286.40 373.60 12864 3736 + +avg-cpu: %user %nice %sys %iowait %idle + 0.15 0.00 0.60 50.85 48.40 + +Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +sda 178.08 1436.64 97.70 14352 976 + + +> Regards, +> Jeff Baker + +From pgsql-performance-owner@postgresql.org Fri Jul 15 18:48:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2B27D52918 + for ; + Fri, 15 Jul 2005 18:48:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52890-01 + for ; + Fri, 15 Jul 2005 21:48:23 +0000 (GMT) +Received: from betsy.gw.rwsoft.ca (S01060080c8fe76dd.ed.shawcable.net + [68.150.80.101]) + by svr1.postgresql.org (Postfix) with ESMTP id 9297A52BC7 + for ; + Fri, 15 Jul 2005 18:48:21 -0300 (ADT) +Received: from deva.gw.rwsoft.ca (unknown [192.168.34.107]) + by betsy.gw.rwsoft.ca (Postfix) with ESMTP id AEECC6BE015; + Fri, 15 Jul 2005 15:48:22 -0600 (MDT) +Date: Fri, 15 Jul 2005 15:48:13 -0600 +Message-ID: <871x5zbv1e.wl%ron@rwsoft.ca> +From: Ron Wills +To: "Jeffrey W. Baker" +Cc: Ron Wills , pgsql-performance@postgresql.org +Subject: Re: Really bad diskio +In-Reply-To: <1121462254.29379.3.camel@toonses.gghcwest.com> +References: <8764vbby7r.wl%ron@rwsoft.ca> <42D82053.1090309@commandprompt.com> + <874qavbx24.wl%ron@rwsoft.ca> + <1121462254.29379.3.camel@toonses.gghcwest.com> +User-Agent: Wanderlust/2.12.2 (99 Luftballons) SEMI/1.14.6 (Maruoka) + FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.4 + (i586-pc-linux-gnu) MULE/5.0 (SAKAKI) +MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.153 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_IN_SORBS_DUL +X-Spam-Level: +X-Archive-Number: 200507/229 +X-Sequence-Number: 13470 + +At Fri, 15 Jul 2005 14:17:34 -0700, +Jeffrey W. Baker wrote: +> +> On Fri, 2005-07-15 at 15:04 -0600, Ron Wills wrote: +> > At Fri, 15 Jul 2005 13:45:07 -0700, +> > Joshua D. Drake wrote: +> > > +> > > Ron Wills wrote: +> > > > Hello all +> > > > +> > > > I'm running a postgres 7.4.5, on a dual 2.4Ghz Athlon, 1Gig RAM and +> > > > an 3Ware SATA raid. +> > > +> > > 2 drives? +> > > 4 drives? +> > > 8 drives? +> > +> > 3 drives raid 5. I don't believe it's the raid. I've tested this by +> > moving the database to the mirrors software raid where the root is +> > found and onto the the SATA raid. Neither relieved the IO problems. +> +> Hard or soft RAID? Which controller? Many of the 3Ware controllers +> (85xx and 95xx) have extremely bad RAID 5 performance. +> +> Did you take any pgbench or other benchmark figures before you started +> using the DB? + + No, unfortunatly, I'm more or less just the developer for the +automation systems and admin the system to keep everything going. I +have very little say in the hardware used and I don't have any +physical access to the machine, it's found a province over :P. + But, for what the system, this IO seems unreasonable. I run +development on a 1.4Ghz Athlon, Gentoo system, with no raid and I +can't reproduce this kind of IO :(. + +> -jwb + +From pgsql-performance-owner@postgresql.org Fri Jul 15 18:54:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 88C5A52AED + for ; + Fri, 15 Jul 2005 18:54:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52137-06 + for ; + Fri, 15 Jul 2005 21:54:47 +0000 (GMT) +Received: from gghcwest.com (adsl-71-128-90-172.dsl.pltn13.pacbell.net + [71.128.90.172]) + by svr1.postgresql.org (Postfix) with ESMTP id 457BB52918 + for ; + Fri, 15 Jul 2005 18:54:46 -0300 (ADT) +Received: from toonses.gghcwest.com (toonses.gghcwest.com [192.168.168.115]) + by gghcwest.com (8.12.10/8.12.9) with ESMTP id j6FLsjmd017625; + Fri, 15 Jul 2005 14:54:46 -0700 +Received: from jwb by toonses.gghcwest.com with local (Exim 4.50) + id 1DtY7a-0007fl-Qq; Fri, 15 Jul 2005 14:53:26 -0700 +Subject: Re: Really bad diskio +From: "Jeffrey W. Baker" +To: Ron Wills +Cc: pgsql-performance@postgresql.org +In-Reply-To: <873bqfbvx9.wl%ron@rwsoft.ca> +References: <8764vbby7r.wl%ron@rwsoft.ca> + <1121461207.28449.8.camel@toonses.gghcwest.com> + <873bqfbvx9.wl%ron@rwsoft.ca> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Date: Fri, 15 Jul 2005 14:53:26 -0700 +Message-Id: <1121464406.29379.12.camel@toonses.gghcwest.com> +Mime-Version: 1.0 +X-Mailer: Evolution 2.3.4 +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200507/230 +X-Sequence-Number: 13471 + +On Fri, 2005-07-15 at 15:29 -0600, Ron Wills wrote: +> Here's a bit of a dump of the system that should be useful. +> +> Processors x2: +> +> vendor_id : AuthenticAMD +> cpu family : 6 +> model : 8 +> model name : AMD Athlon(tm) MP 2400+ +> stepping : 1 +> cpu MHz : 2000.474 +> cache size : 256 KB +> +> MemTotal: 903804 kB +> +> Mandrake 10.0 Linux kernel 2.6.3-19mdk +> +> The raid controller, which is using the hardware raid configuration: +> +> 3ware 9000 Storage Controller device driver for Linux v2.26.02.001. +> scsi0 : 3ware 9000 Storage Controller +> 3w-9xxx: scsi0: Found a 3ware 9000 Storage Controller at 0xe8020000, IRQ: 17. +> 3w-9xxx: scsi0: Firmware FE9X 2.02.00.011, BIOS BE9X 2.02.01.037, Ports: 4. +> Vendor: 3ware Model: Logical Disk 00 Rev: 1.00 +> Type: Direct-Access ANSI SCSI revision: 00 +> SCSI device sda: 624955392 512-byte hdwr sectors (319977 MB) +> SCSI device sda: drive cache: write back, no read (daft) +> +> This is also on a 3.6 reiser filesystem. +> +> Here's the iostat for 10mins every 10secs. I've removed the stats from +> the idle drives to reduce the size of this email. +> +> Linux 2.6.3-19mdksmp (photo_server) 07/15/2005 +> +> avg-cpu: %user %nice %sys %iowait %idle +> 2.85 1.53 2.15 39.52 53.95 +> +> Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +> sda 82.49 4501.73 188.38 1818836580 76110154 +> +> avg-cpu: %user %nice %sys %iowait %idle +> 0.30 0.00 1.00 96.30 2.40 +> +> Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +> sda 87.80 6159.20 340.00 61592 3400 + +These I/O numbers are not so horrible, really. 100% iowait is not +necessarily a symptom of misconfiguration. It just means you are disk +limited. With a database 20 times larger than main memory, this is no +surprise. + +If I had to speculate about the best way to improve your performance, I +would say: + +1a) Get a better RAID controller. The 3ware hardware RAID5 is very bad. +1b) Get more disks. +2) Get a (much) newer kernel. +3) Try XFS or JFS. Reiser3 has never looked good in my pgbench runs + +By the way, are you experiencing bad application performance, or are you +just unhappy with the iostat figures? + +Regards, +jwb + + +From pgsql-performance-owner@postgresql.org Fri Jul 15 19:11:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6B10652BC7 + for ; + Fri, 15 Jul 2005 19:11:55 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53776-10 + for ; + Fri, 15 Jul 2005 22:11:48 +0000 (GMT) +Received: from betsy.gw.rwsoft.ca (S01060080c8fe76dd.ed.shawcable.net + [68.150.80.101]) + by svr1.postgresql.org (Postfix) with ESMTP id DB42252918 + for ; + Fri, 15 Jul 2005 19:11:47 -0300 (ADT) +Received: from deva.gw.rwsoft.ca (unknown [192.168.34.107]) + by betsy.gw.rwsoft.ca (Postfix) with ESMTP id 017BA5FD7; + Fri, 15 Jul 2005 16:11:48 -0600 (MDT) +Date: Fri, 15 Jul 2005 16:11:39 -0600 +Message-ID: <87zmsnafdw.wl%ron@rwsoft.ca> +From: Ron Wills +To: "Jeffrey W. Baker" +Cc: Ron Wills , pgsql-performance@postgresql.org +Subject: Re: Really bad diskio +In-Reply-To: <1121464406.29379.12.camel@toonses.gghcwest.com> +References: <8764vbby7r.wl%ron@rwsoft.ca> + <1121461207.28449.8.camel@toonses.gghcwest.com> + <873bqfbvx9.wl%ron@rwsoft.ca> + <1121464406.29379.12.camel@toonses.gghcwest.com> +User-Agent: Wanderlust/2.12.2 (99 Luftballons) SEMI/1.14.6 (Maruoka) + FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.4 + (i586-pc-linux-gnu) MULE/5.0 (SAKAKI) +MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.153 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_IN_SORBS_DUL +X-Spam-Level: +X-Archive-Number: 200507/231 +X-Sequence-Number: 13472 + +At Fri, 15 Jul 2005 14:53:26 -0700, +Jeffrey W. Baker wrote: +> +> On Fri, 2005-07-15 at 15:29 -0600, Ron Wills wrote: +> > Here's a bit of a dump of the system that should be useful. +> > +> > Processors x2: +> > +> > vendor_id : AuthenticAMD +> > cpu family : 6 +> > model : 8 +> > model name : AMD Athlon(tm) MP 2400+ +> > stepping : 1 +> > cpu MHz : 2000.474 +> > cache size : 256 KB +> > +> > MemTotal: 903804 kB +> > +> > Mandrake 10.0 Linux kernel 2.6.3-19mdk +> > +> > The raid controller, which is using the hardware raid configuration: +> > +> > 3ware 9000 Storage Controller device driver for Linux v2.26.02.001. +> > scsi0 : 3ware 9000 Storage Controller +> > 3w-9xxx: scsi0: Found a 3ware 9000 Storage Controller at 0xe8020000, IRQ: 17. +> > 3w-9xxx: scsi0: Firmware FE9X 2.02.00.011, BIOS BE9X 2.02.01.037, Ports: 4. +> > Vendor: 3ware Model: Logical Disk 00 Rev: 1.00 +> > Type: Direct-Access ANSI SCSI revision: 00 +> > SCSI device sda: 624955392 512-byte hdwr sectors (319977 MB) +> > SCSI device sda: drive cache: write back, no read (daft) +> > +> > This is also on a 3.6 reiser filesystem. +> > +> > Here's the iostat for 10mins every 10secs. I've removed the stats from +> > the idle drives to reduce the size of this email. +> > +> > Linux 2.6.3-19mdksmp (photo_server) 07/15/2005 +> > +> > avg-cpu: %user %nice %sys %iowait %idle +> > 2.85 1.53 2.15 39.52 53.95 +> > +> > Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +> > sda 82.49 4501.73 188.38 1818836580 76110154 +> > +> > avg-cpu: %user %nice %sys %iowait %idle +> > 0.30 0.00 1.00 96.30 2.40 +> > +> > Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn +> > sda 87.80 6159.20 340.00 61592 3400 +> +> These I/O numbers are not so horrible, really. 100% iowait is not +> necessarily a symptom of misconfiguration. It just means you are disk +> limited. With a database 20 times larger than main memory, this is no +> surprise. +> +> If I had to speculate about the best way to improve your performance, I +> would say: +> +> 1a) Get a better RAID controller. The 3ware hardware RAID5 is very bad. +> 1b) Get more disks. +> 2) Get a (much) newer kernel. +> 3) Try XFS or JFS. Reiser3 has never looked good in my pgbench runs + +Not good news :(. I can't change the hardware, hopefully a kernel +update and XFS of JFS will make an improvement. I was hoping for +software raid (always has worked well), but the client didn't feel +conforable with it :P. + +> By the way, are you experiencing bad application performance, or are you +> just unhappy with the iostat figures? + + It's affecting the whole system. It is sending the load averages +through the roof (from 4 to 12) and processes that would take only a +few minutes starts going over an hour, until it clears up. Well, I +guess I'll have to drum up some more programming magic... and I'm +starting to run out of tricks... I love my job some day :$ + +> Regards, +> jwb +> + +From pgsql-performance-owner@postgresql.org Fri Jul 15 21:06:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 19C8F52C17 + for ; + Fri, 15 Jul 2005 21:06:55 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79296-04 + for ; + Sat, 16 Jul 2005 00:06:44 +0000 (GMT) +Received: from ionian.i-clic.uihc.uiowa.edu (ionian.i-clic.uihc.uiowa.edu + [129.255.211.20]) + by svr1.postgresql.org (Postfix) with ESMTP id BF78E52B06 + for ; + Fri, 15 Jul 2005 21:06:42 -0300 (ADT) +Received: by ionian.i-clic.uihc.uiowa.edu (Postfix, from userid 76) + id 0E6B561DB0; Fri, 15 Jul 2005 17:59:16 -0500 (CDT) +Received: from [192.168.5.232] (69-212-77-18.ded.ameritech.net [69.212.77.18]) + by ionian.i-clic.uihc.uiowa.edu (Postfix) with ESMTP + id 6A51B61DAF; Fri, 15 Jul 2005 17:59:04 -0500 (CDT) +Message-ID: <42D84F86.8070100@arbash-meinel.com> +Date: Fri, 15 Jul 2005 19:06:30 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: slow joining very large table to smaller ones +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + + <42D6F177.3000002@arbash-meinel.com> + + <42D70E42.90403@arbash-meinel.com> + + <42D7379F.3040806@arbash-meinel.com> + +In-Reply-To: +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig003EECB873ACA41B72F2B48F" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/232 +X-Sequence-Number: 13473 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig003EECB873ACA41B72F2B48F +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Dan Harris wrote: +> +> On Jul 14, 2005, at 10:12 PM, John A Meinel wrote: +> +>> +>> My biggest question is why the planner things the Nested Loop would be +>> so expensive. +>> Have you tuned any of the parameters? It seems like something is out of +>> whack. (cpu_tuple_cost, random_page_cost, etc...) +>> +> +> here's some of my postgresql.conf. Feel free to blast me if I did +> something idiotic here. +> +> shared_buffers = 50000 +> effective_cache_size = 1348000 +> random_page_cost = 3 +> work_mem = 512000 + +Unless you are the only person connecting to this database, your +work_mem is very high. And if you haven't modified maintenance_work_mem +it is probably very low. work_mem might be causing postgres to think it +can fit all of a merge into ram, making it faster, I can't say for sure. + +> max_fsm_pages = 80000 + +This seems high, but it depends how many updates/deletes you get +in-between vacuums. It may not be too excessive. VACUUM [FULL] VERBOSE +replies with how many free pages are left, if you didn't use that +already for tuning. Though it should be tuned based on a steady state +situation. Not a one time test. + +> log_min_duration_statement = 60000 +> fsync = true ( not sure if I'm daring enough to run without this ) +> wal_buffers = 1000 +> checkpoint_segments = 64 +> checkpoint_timeout = 3000 +> + +These seem fine to me. + +Can you include the output of EXPLAIN SELECT both with and without SET +join_collapselimit? Since your tables have grown, I can't compare the +estimated number of rows, and costs very well. + +EXPLAIN without ANALYZE is fine, since I am wondering what the planner +is thinking things cost. + +John +=:-> + +> +> #---- FOR PG_AUTOVACUUM --# +> stats_command_string = true +> stats_row_level = true +> + +--------------enig003EECB873ACA41B72F2B48F +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC2E+GJdeBCYSNAAMRAmNwAJ4lc3ufVj1sI25w9rG9zKWZzuF2mgCfRJXx +WwfkpkIko3+KDaDEKAIcb50= +=eXdN +-----END PGP SIGNATURE----- + +--------------enig003EECB873ACA41B72F2B48F-- + +From pgsql-performance-owner@postgresql.org Sat Jul 16 05:12:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0075752D97 + for ; + Sat, 16 Jul 2005 05:12:39 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04759-06 + for ; + Sat, 16 Jul 2005 08:12:29 +0000 (GMT) +Received: from mail22.sea5.speakeasy.net (mail22.sea5.speakeasy.net + [69.17.117.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 090E152D96 + for ; + Sat, 16 Jul 2005 05:12:26 -0300 (ADT) +Received: (qmail 1490 invoked from network); 16 Jul 2005 08:12:27 -0000 +Received: from dsl081-060-184.sfo1.dsl.speakeasy.net (HELO noodles) + ([64.81.60.184]) (envelope-sender ) + by mail22.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP + for ; 16 Jul 2005 08:12:27 -0000 +Received: from jwb by noodles with local (Exim 3.36 #1 (Debian)) + id 1Dthmd-0001un-00 + for ; Sat, 16 Jul 2005 01:12:27 -0700 +Subject: more filesystem benchmarks +From: "Jeffrey W. Baker" +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Date: Sat, 16 Jul 2005 01:12:27 -0700 +Message-Id: <1121501547.7101.18.camel@noodles> +Mime-Version: 1.0 +X-Mailer: Evolution 2.3.4 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/233 +X-Sequence-Number: 13474 + +In our last installment, we saw that JFS provides higher pgbench +performance than either XFS or ext3. Using a direct-I/O patch stolen +from 8.1, JFS achieved 105 tps with 100 clients. + +To refresh, the machine in question has 5 7200RPM SATA disks, an Areca +RAID controller with 128MB cache, and 1GB of main memory. pgbench is +being run with a scale factor of 1000 and 100000 total transactions. + +At the suggestion of Andreas Dilger of clusterfs, I tried modulating the +size of the ext3 journal, and the mount options (data=journal, +writeback, and ordered). I turns out that you can achieve a substantial +improvement (almost 50%) by simply mounting the ext3 volume with +data=writeback instead of data=ordered (the default). Changing the +journal size did not seem to make a difference, except that 256MB is for +some reason pathological (9% slower than the best time). 128MB, the +default for a large volume, gave the same performance as 400MB (the max) +or 32MB. + +In the end, the ext3 volume mounted with -o noatime,data=writeback +yielded 88 tps with 100 clients. This is about 16% off the performance +of JFS with default options. + +Andreas pointed me to experimental patches to ext3's block allocation +code and writeback strategy. I will test these, but I expect the +database community, which seems so attached to its data, will be very +interested in code that has not yet entered mainstream use. + +Another frequent suggestion is to put the xlog on a separate device. I +tried this, and, for a given number of disks, it appears to be +counter-productive. A RAID5 of 5 disks holding both logs and data is +about 15% faster than a RAID5 of 3 disks with the data, and a mirror of +two disks holding the xlog. + +Here are the pgbench results for each permutation of ext3: + +Journal Size | Journal Mode | 1 Client | 10 Clients | 100 Clients +------------------------------------------------------------------ +32 ordered 28 51 57 +32 writeback 34 70 88 +64 ordered 29 52 61 +64 writeback 32 69 87 +128 ordered 32 54 62 +128 writeback 34 70 88 +256 ordered 28 51 60 +256 writeback 29 64 79 +400 ordered 26 49 59 +400 writeback 32 70 87 + +-jwb + +From pgsql-performance-owner@postgresql.org Sat Jul 16 08:01:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1EC8852A8A + for ; + Sat, 16 Jul 2005 08:01:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 33148-06 + for ; + Sat, 16 Jul 2005 11:01:11 +0000 (GMT) +Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E4E952A81 + for ; + Sat, 16 Jul 2005 08:01:07 -0300 (ADT) +Received: from osgiliath.mathom.us ([70.108.53.154]) + by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IJP0087AVXXZG04@vms040.mailsrvcs.net> for + pgsql-performance@postgresql.org; Sat, 16 Jul 2005 06:01:09 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id 1EB796005E6; Sat, + 16 Jul 2005 07:01:09 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 23919-01-8; Sat, 16 Jul 2005 07:01:09 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id F313B600197; Sat, 16 Jul 2005 07:01:08 -0400 (EDT) +Date: Sat, 16 Jul 2005 07:01:08 -0400 +From: Michael Stone +Subject: Re: more filesystem benchmarks +In-reply-to: <1121501547.7101.18.camel@noodles> +To: "Jeffrey W. Baker" +Cc: pgsql-performance@postgresql.org +Mail-Followup-To: "Jeffrey W. Baker" , + pgsql-performance@postgresql.org +Message-id: <20050716110108.GL19080@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us +References: <1121501547.7101.18.camel@noodles> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/234 +X-Sequence-Number: 13475 + +On Sat, Jul 16, 2005 at 01:12:27AM -0700, Jeffrey W. Baker wrote: +>Another frequent suggestion is to put the xlog on a separate device. I +>tried this, and, for a given number of disks, it appears to be +>counter-productive. A RAID5 of 5 disks holding both logs and data is +>about 15% faster than a RAID5 of 3 disks with the data, and a mirror of +>two disks holding the xlog. + +Try simply a seperate partition on the same device with a different +filesystem (ext2). + +Mike Stone + +From pgsql-performance-owner@postgresql.org Sat Jul 16 18:15:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4E5245299A + for ; + Sat, 16 Jul 2005 18:15:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 43351-09 + for ; + Sat, 16 Jul 2005 21:15:03 +0000 (GMT) +Received: from betsy.gw.rwsoft.ca (S01060080c8fe76dd.ed.shawcable.net + [68.150.80.101]) + by svr1.postgresql.org (Postfix) with ESMTP id 9AB14529BB + for ; + Sat, 16 Jul 2005 18:15:00 -0300 (ADT) +Received: from deva.gw.rwsoft.ca (unknown [192.168.34.107]) + by betsy.gw.rwsoft.ca (Postfix) with ESMTP id 0FA39CDD7 + for ; + Sat, 16 Jul 2005 15:15:01 -0600 (MDT) +Date: Sat, 16 Jul 2005 15:14:55 -0600 +Message-ID: <871x5yh2r4.wl%ron@rwsoft.ca> +From: Ron Wills +To: pgsql-performance@postgresql.org +Subject: Re: Really bad diskio +In-Reply-To: <8764vbby7r.wl%ron@rwsoft.ca> +References: <8764vbby7r.wl%ron@rwsoft.ca> +User-Agent: Wanderlust/2.12.2 (99 Luftballons) SEMI/1.14.6 (Maruoka) + FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.4 + (i586-pc-linux-gnu) MULE/5.0 (SAKAKI) +MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.153 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_IN_SORBS_DUL +X-Spam-Level: +X-Archive-Number: 200507/235 +X-Sequence-Number: 13476 + +At Fri, 15 Jul 2005 14:39:36 -0600, +Ron Wills wrote: + + I just wanted to thank everyone for their help. I believe we found a +solution that will help with this problem, with the hardware +configuration and caching the larger tables into smaller data sets. +A valuable lesson learned from this ;) + +> Hello all +> +> I'm running a postgres 7.4.5, on a dual 2.4Ghz Athlon, 1Gig RAM and +> an 3Ware SATA raid. Currently the database is only 16G with about 2 +> tables with 500000+ row, one table 200000+ row and a few small +> tables. The larger tables get updated about every two hours. The +> problem I having with this server (which is in production) is the disk +> IO. On the larger tables I'm getting disk IO wait averages of +> ~70-90%. I've been tweaking the linux kernel as specified in the +> PostgreSQL documentations and switched to the deadline +> scheduler. Nothing seems to be fixing this. The queries are as +> optimized as I can get them. fsync is off in an attempt to help +> preformance still nothing. Are there any setting I should be look at +> the could improve on this??? +> +> Thanks for and help in advance. +> +> Ron +> +> ---------------------------(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 Sat Jul 16 18:42:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7E28852986 + for ; + Sat, 16 Jul 2005 18:42:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55412-01 + for ; + Sat, 16 Jul 2005 21:42:24 +0000 (GMT) +Received: from e4.ny.us.ibm.com (e4.ny.us.ibm.com [32.97.182.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 231E95280D + for ; + Sat, 16 Jul 2005 18:42:22 -0300 (ADT) +Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) + by e4.ny.us.ibm.com (8.12.11/8.12.11) with ESMTP id j6GLgOCc013790 + for ; Sat, 16 Jul 2005 17:42:24 -0400 +Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) + by d01relay02.pok.ibm.com (8.12.10/NCO/VERS6.7) with ESMTP id + j6GLgOSw259422 + for ; Sat, 16 Jul 2005 17:42:24 -0400 +Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) + by d01av03.pok.ibm.com (8.12.11/8.13.3) with ESMTP id j6GLgOhd025396 + for ; Sat, 16 Jul 2005 17:42:24 -0400 +Received: from d01ml255.pok.ibm.com (d01ml255.pok.ibm.com [9.56.227.128]) + by d01av03.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j6GLgOPO025393 + for ; Sat, 16 Jul 2005 17:42:24 -0400 +Subject: Questions about temporary tables and performance +To: pgsql-performance@postgresql.org +X-Mailer: Lotus Notes Release 6.0.2CF1 June 9, 2003 +Message-ID: + +From: Steven Rosenstein +Date: Sat, 16 Jul 2005 17:42:21 -0400 +X-MIMETrack: Serialize by Router on D01ML255/01/M/IBM(Release 6.53HF103 | + November 15, 2004) at 07/16/2005 17:42:23 +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.308 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200507/236 +X-Sequence-Number: 13477 + + + + + +Postgres Version: +7.3.9 and 8.0.1 (different sites use different versions depending on when +they first installed Postgres) + +Migration Plans: +All sites on 8.n within the next 6-9 months. + +Scenario: +A temporary table is created via a "SELECT blah INTO TEMPORARY TABLE blah +FROM...". The SELECT query is composed of a number of joins on small +(thousands of rows) parameter tables. A view is not usable here because +the temporary table SELECT query is constructed on the fly in PHP with JOIN +parameters and WHERE filters that may change from main query set to main +query set. + +After the table is created, the key main query JOIN parameter (device ID) +is indexed. The resulting temporary table is at most 3000-4000 small (128 +byte) records. + +The temporary table is then joined in a series of SELECT queries to other +data tables in the database that contain information associated with the +records in the temporary table. These secondary tables can have tens of +millions of records each. After the queries are executed, the DB +connection is closed and the temporary table and index automatically +deleted. + +Are there any performance issues or considerations associated with using a +temporary table in this scenario? Is it worth my trying to develop a +solution that just incorporates all the logic used to create the temporary +table into each of the main queries? How expensive an operation is +temporary table creation and joining? + +Thanks in advance for your advice, +--- Steve + + +From pgsql-performance-owner@postgresql.org Sun Jul 17 01:45:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0885752808 + for ; + Sun, 17 Jul 2005 01:45:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92175-10 + for ; + Sun, 17 Jul 2005 04:44:54 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 087A25298F + for ; + Sun, 17 Jul 2005 01:44:53 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6H4irIP025142; + Sun, 17 Jul 2005 00:44:54 -0400 (EDT) +To: Steven Rosenstein +Cc: pgsql-performance@postgresql.org +Subject: Re: Questions about temporary tables and performance +In-reply-to: + +References: + +Comments: In-reply-to Steven Rosenstein + message dated "Sat, 16 Jul 2005 17:42:21 -0400" +Date: Sun, 17 Jul 2005 00:44:53 -0400 +Message-ID: <25141.1121575493@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/237 +X-Sequence-Number: 13478 + +Steven Rosenstein writes: +> Are there any performance issues or considerations associated with using a +> temporary table in this scenario? + +It's probably worthwhile to ANALYZE the temp table after it's filled, +before you start joining to it. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sun Jul 17 14:08:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BB18852A01 + for ; + Sun, 17 Jul 2005 14:08:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30619-04 + for ; + Sun, 17 Jul 2005 17:08:36 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) + by svr1.postgresql.org (Postfix) with ESMTP id F2759529AE + for ; + Sun, 17 Jul 2005 14:08:34 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i20so896329wra + for ; + Sun, 17 Jul 2005 10:08:34 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; + b=npB0MedYWEN3MZti1i8wYb+RpUXj7rV2X3itk7CErwulQ3FcXOWCcapGJer/zfxQgV7v9A/CjjR3xGeLoOrziVzDLxU1r+4vN+kdHSlcDceg3b3EJws3cu/fHikb1UrRBm5cUf82o+ibwlnd62p4YE+lUt7TpaXLi54jdpdFqps= +Received: by 10.54.32.52 with SMTP id f52mr126241wrf; + Sun, 17 Jul 2005 10:08:34 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Sun, 17 Jul 2005 10:08:34 -0700 (PDT) +Message-ID: <59d991c4050717100874c08a86@mail.gmail.com> +Date: Sun, 17 Jul 2005 13:08:34 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: pgsql-performance@postgresql.org +Subject: Impact of checkpoint_segments under continual load conditions +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.128 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/238 +X-Sequence-Number: 13479 + +I have a unique scenerio. My DB is under "continual load", meaning +that I am constantly using COPY to insert new data into the DB. There +is no "quiet period" for the database, at least not for hours on end.=20 +Normally, checkpoint_segments can help absorb some of that, but my +experience is that if I crank the number up, it simply delays the +impact, and when it occurs, it takes a VERY long time (minutes) to +clear. + +Thoughts? +Chris +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Sun Jul 17 15:16:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4780652AEC + for ; + Sun, 17 Jul 2005 15:16:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40779-09 + for ; + Sun, 17 Jul 2005 18:15:55 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 33DC852A22 + for ; + Sun, 17 Jul 2005 15:15:54 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6HIFsa7018943; + Sun, 17 Jul 2005 14:15:54 -0400 (EDT) +To: Christopher Petrilli +Cc: pgsql-performance@postgresql.org +Subject: Re: Impact of checkpoint_segments under continual load conditions +In-reply-to: <59d991c4050717100874c08a86@mail.gmail.com> +References: <59d991c4050717100874c08a86@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Sun, 17 Jul 2005 13:08:34 -0400" +Date: Sun, 17 Jul 2005 14:15:54 -0400 +Message-ID: <18942.1121624154@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/239 +X-Sequence-Number: 13480 + +Christopher Petrilli writes: +> I have a unique scenerio. My DB is under "continual load", meaning +> that I am constantly using COPY to insert new data into the DB. There +> is no "quiet period" for the database, at least not for hours on end. +> Normally, checkpoint_segments can help absorb some of that, but my +> experience is that if I crank the number up, it simply delays the +> impact, and when it occurs, it takes a VERY long time (minutes) to +> clear. + +If you are using 8.0, you can probably alleviate the problem by making +the bgwriter more aggressive. I don't have any immediate +recommendations for specific settings though. + +A small checkpoint_segments setting is definitely bad news for +performance under heavy load. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 18 00:34:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F117D52AC6 + for ; + Mon, 18 Jul 2005 00:34:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65918-01 + for ; + Mon, 18 Jul 2005 03:34:43 +0000 (GMT) +Received: from rambo.iniquinet.com (rambo.iniquinet.com [69.39.89.10]) + by svr1.postgresql.org (Postfix) with ESMTP id B4AF452AC0 + for ; + Mon, 18 Jul 2005 00:34:41 -0300 (ADT) +Received: (qmail 25274 invoked by uid 1010); 17 Jul 2005 23:34:40 -0400 +Received: from Robert_Creager@LogicalChaos.org by rambo.iniquinet.com by uid + 1002 with qmail-scanner-1.20 (clamscan: 0.70. spamassassin: 3.0.3. + Clear:RC:0(63.147.78.131):SA:0(?/?):. + Processed in 4.443716 secs); 18 Jul 2005 03:34:40 -0000 +Received: from unknown (HELO thunder.logicalchaos.org) + (perl?test@logicalchaos.org@63.147.78.131) + by rambo.iniquinet.com with AES256-SHA encrypted SMTP; + 17 Jul 2005 23:34:36 -0400 +Received: from logicalchaos.org (thunder.logicalchaos.org [192.168.0.250]) + by thunder.logicalchaos.org (Postfix) with ESMTP id A3DFE311CB; + Sun, 17 Jul 2005 21:34:34 -0600 (MDT) +Date: Sun, 17 Jul 2005 21:34:16 -0600 +From: Robert Creager +To: PGPerformance , + Andy Hewitt +Subject: Huge performance problem between 7.4.1 and 8.0.3 - CS issue? +Message-ID: <20050717213416.59dcb52e@thunder.logicalchaos.org> +Organization: Starlight Vision, LLC. +X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i586-mandrake-linux-gnu) +Mime-Version: 1.0 +Content-Type: multipart/signed; + boundary="Signature_Sun__17_Jul_2005_21_34_16_-0600__=pJJtTXBIjc/Vrz"; + protocol="application/pgp-signature"; micalg=pgp-sha1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/240 +X-Sequence-Number: 13481 + +--Signature_Sun__17_Jul_2005_21_34_16_-0600__=pJJtTXBIjc/Vrz +Content-Type: multipart/mixed; + boundary="Multipart_Sun__17_Jul_2005_21_34_16_-0600_=WUE/07VkC53E0WZ" + +--Multipart_Sun__17_Jul_2005_21_34_16_-0600_=WUE/07VkC53E0WZ +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + + +Sigh... + +I recently upgraded from 7.4.1 to 8.0.3. The application did not change. = +I'm +now running both database concurrently (on different ports, same machine) j= +ust +so I could verify the problem really exists. + +The application is a custom test application for testing mechanical systems= +.=20 +The runs in question (4 at a time) each generate 16 queries at a time of wh= +ich +the results are sent to the mechanical system which processes the request, = +which +processes them anywhere from 10 to 120 seconds. The system is capable of +completing between 4 and 8 jobs at once. So, once the system is running, at +most there will be 8 queries per run simultaneously. + +The entire database fits into RAM (2Gb), as evidenced by no disk activity a= +nd +relatively small database size. pg_xlog is on different disks from the db. + +The problem is that on version 8.0.3, once I get 3 or more concurrent runs +going, the query times start tanking (>20 seconds). On 7.4.1, the applicat= +ions +hum along with queries typically below .2 seconds on over 5 concurrent runs= +.=20 +Needless to say, 7.4.1 behaves as expected... The only change between runs= + is +the port connecting to. Bot DB's are up at the same time. + +For 8.03, pg_autovacuum is running. On 7.4.1, I set up a cron job to vacuum +analyze every 5 minutes. + +The system is Mandrake Linux running 2.4.22 kernel with dual Intel Xenon CPU +with HT enabled. On an 803 run, the context switching is up around 60k. On +7.4.1, it maxes around 23k and averages < 1k. + +I've attached four files. 741 has the query and explain analyze. 803 has = +the +query and explain analyze during loaded and unloaded times. I've also atta= +ched +the conf files for the two versions running. I've gone through them and do= +n't +see any explanation for the problem I'm having. + +I'm guessing this is the CS problem that reared it's head last year? I had= + an +e-mail exchange in April of last year about this. Any reason this would be +worse with 8.0.3? + +Thanks, +Rob + +--=20 + 13:33:43 up 3 days, 17:08, 9 users, load average: 0.16, 0.59, 0.40 +Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + +--Multipart_Sun__17_Jul_2005_21_34_16_-0600_=WUE/07VkC53E0WZ +Content-Type: application/octet-stream; name=741 +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; filename=741 + +U0VMRUNUIGxvY2F0aW9uX3R5cGUubmFtZSBBUyBsb2NhdGlvbl90eXBlX25hbWUsCmxpYnJhcnks +IHJhaWwsIGNvbCwgc2lkZSwgcm93LCBsb2NhdGlvbl9pZCwKaGxpX2xzbSwgaGxpX3BhbmVsLCBo +bGlfcm93LCBobGlfY29sCkZST00gbG9jYXRpb24gSk9JTiBsb2NhdGlvbl90eXBlIFVTSU5HKCBs +b2NhdGlvbl90eXBlX2lkICkKSk9JTiBjb21wbGV4IFVTSU5HKCBsaWJyYXJ5X2lkICkKTEVGVCBP +VVRFUiBKT0lOIGhsaV9sb2NhdGlvbiBVU0lORyggbG9jYXRpb25faWQgKQpMRUZUIE9VVEVSIEpP +SU4gYXBwbGljYXRpb24gVVNJTkcoIGFwcGxpY2F0aW9uX2lkICkKV0hFUkUgIGNvbXBsZXguY29t +cGxleF9pZCA9ICc0JwpBTkQgbG9jYX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AxMSByb3dzPTEgbG9vcHM9NDg2KQogICAgICAgICBJbmRleCBDb25kOiAo +Im91dGVyIi5sb2NhdGlvbl90eXBlX2lkID0gbG9jYXRpb25fdHlwZS5sb2NhdGlvbl90eXBlX2lk +KQogICAgICAgICBGaWx0ZXI6ICgobmFtZSk6OnRleHQgfiAnY2VsbCc6OnRleHQpCiBUb3RhbCBy +dW50aW1lOiAyODcuODA1IG1zCigyMiByb3dzKQoK + +--Multipart_Sun__17_Jul_2005_21_34_16_-0600_=WUE/07VkC53E0WZ +Content-Type: application/octet-stream; name=803 +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; filename=803 + +ClNFVCBUUkFOU0FDVElPTiBJU09MQVRJT04gTEVWRUwgU0VSSUFMSVpBQkxFIFJFQUQgV1JJVEU7 +CgpTRUxFQ1QgbG9jYXRpb25fdHlwZS5uYW1lIEFTIGxvY2F0aW9uX3R5cGVfbmFtZSwKbGlicmFy +eSwgcmFpbCwgY29sLCBzaWRlLCByb3csIGxvY2F0aW9uX2lkLApobGlfbHNtLCBobGlfcGFuZWws +IGhsaV9yb3csIGhsaV9jb2wKRlJPTSBsb2NhdGlvbiBKT0lOIGxvY2F0aW9uX3R5cGUgVVNJTkco +IGxvY2F0aW9uX3R5cGVfaWQgKQpKT0lOIGNvbXBsZXggVVNJTkcoIGxpYnJhcnlfaWQgKQpMRUZU +IE9VVEVSIEpPSU4gaGxpX2xvY2F0aW9uIFVTSU5HKCBsb2NhdGlvbl9pZCApCkxFRlQgT1VURVIg +Sk9JTiBhcHBsaWNhdGlvbiBVU0lORyggYXBwbGljYXRpb25faWQgKQpXSEVSRSAgY29tcGxleC5j +b21wbGV4X2lkID0gJzE3NicKQU5EIGxvY2F0aW9uX2lkIE5PVCBJTgooU0VMRUNUIGxvY2F0aW9u +X2lkCkZST00gbG9jYXRpb25fbG9jaykKQU5EIGxvY2F0aW9uX2lkIE5PVCBJTgooU0VMRUNUIGxv +Y2F0aW9uX2lkCkZST00gY2FydHJpZGd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gICAgICAgICAgICAgRmlsdGVyOiAoKG5hbWUpOjp0 +ZXh0IH4gJ2NlbGwnOjp0ZXh0KQogICAgICAgICAtPiAgSW5kZXggU2NhbiB1c2luZyBobGlfbG9j +YXRpb25fbG9jYXRpb25faWQgb24gaGxpX2xvY2F0aW9uICAoY29zdD0wLjAwLi4zLjE2IHJvd3M9 +MSB3aWR0aD0yNCkgKGFjdHVhbCB0aW1lPTAuMDExLi4wLjAxMSByb3dzPTAgbG9vcHM9NTc2KQog +ICAgICAgICAgICAgICBJbmRleCBDb25kOiAoIm91dGVyIi5sb2NhdGlvbl9pZCA9IGhsaV9sb2Nh +dGlvbi5sb2NhdGlvbl9pZCkKICAgICAgICAgICAgICAgRmlsdGVyOiAoKGhsaV9sc20pOjppbnRl +Z2VyID0gMSkKIFRvdGFsIHJ1bnRpbWU6IDI0Ni45OTUgbXMKCg== + +--Multipart_Sun__17_Jul_2005_21_34_16_-0600_=WUE/07VkC53E0WZ +Content-Type: application/octet-stream; name=postgres741.conf +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; filename=postgres741.conf + +IyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQojIFBvc3RncmVTUUwgY29uZmlndXJhdGlv +biBmaWxlCiMgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KIwojIFRoaXMgZmlsZSBjb25z +aXN0cyBvZiBsaW5lcyBvZiB0aGUgZm9ybToKIwojICAgbmFtZSA9IHZhbHVlCiMKIyAoVGhlICc9 +JyBpcyBvcHRpb25hbC4pIFdoaXRlIHNwYWNlIG1heSBiZSB1c2VkLiBDb21tZW50cyBhcmUgaW50 +cm9kdWNlZAojIHdpdGggJyMnIGFueXdoZXJlIG9uIGEgbGluZS4gVGhlIGNvbXBsZXRlIGxpc3Qg +b2Ygb3B0aW9uIG5hbWVzIGFuZAojIGFsbG93ZWQgdmFsdWVzIGNhbiBiZSBmb3VuZCBpbiB0aGUg +UG9zdGdyZVNRTCBk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zZWNv +bmRzCiNtYXhfbG9ja3NfcGVyX3RyYW5zYWN0aW9uID0gNjQJIyBtaW4gMTAsIH4yNjAqbWF4X2Nv +bm5lY3Rpb25zIGJ5dGVzIGVhY2gKCgojLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCiMgVkVSU0lPTi9QTEFU +Rk9STSBDT01QQVRJQklMSVRZCiMtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KCiMgLSBQcmV2aW91cyBQb3N0 +Z3JlcyBWZXJzaW9ucyAtCgphZGRfbWlzc2luZ19mcm9tID0gZmFsc2UKI3JlZ2V4X2ZsYXZvciA9 +IGFkdmFuY2VkCSMgYWR2YW5jZWQsIGV4dGVuZGVkLCBvciBiYXNpYwpzcWxfaW5oZXJpdGFuY2Ug +PSBmYWxzZQoKIyAtIE90aGVyIFBsYXRmb3JtcyAmIENsaWVudHMgLQoKI3RyYW5zZm9ybV9udWxs +X2VxdWFscyA9IGZhbHNlCg== + +--Multipart_Sun__17_Jul_2005_21_34_16_-0600_=WUE/07VkC53E0WZ +Content-Type: application/octet-stream; name=postgres803.conf +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; filename=postgres803.conf + +IyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQojIFBvc3RncmVTUUwgY29uZmlndXJhdGlv +biBmaWxlCiMgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KIwojIFRoaXMgZmlsZSBjb25z +aXN0cyBvZiBsaW5lcyBvZiB0aGUgZm9ybToKIwojICAgbmFtZSA9IHZhbHVlCiMKIyAoVGhlICc9 +JyBpcyBvcHRpb25hbC4pIFdoaXRlIHNwYWNlIG1heSBiZSB1c2VkLiB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oKSBlc2NhcGVzCiNsb2dfdHJ1bmNhdGVfb25fcm90YXRpb24gPSBmYWxzZSAgIyBJZiB0cnVl +LCBhbnkgZXhpc3RpbmcgbG9nIGZpbGUgb2YgdGhlIAogICAgICAgICAgICAgICAgICAgICAgICAg +ICAgIyBzYW1lIG5hbWUgYXMgdGhlIG5ldyBsb2cgZmlsZSB3aWxsIGJlIHRydW5jYXRlZAogICAg +ICAgICAgICAgICAgICAgICAgICAgICAgIyByYXRoZXIgdGhhbiBhcHBlbmRlZCB0by4gIEJ1dCBz +dWNoIHRydW5jYXRpb24KICAgICAgICAgICAgICAgICAgICAgICAgICAgICMgb25seSBvY2N1cnMg +b24gdGltZS1kcml2ZW4gcm90YXRpb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAjIG5v +dCBvbiByZXN0YXJ0cyBvciBzaXplLWRyaXZlbiByb3RhdGlvbi4KICAgICAgICAgICAgICAgICAg +ICAgICAgICAgICMgRGVmYXVsdCBpcyBmYWxzZSwgbWVhbmluZyBhcHBlbmQgdG8gZXhpc3Rpbmcg +CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAjIGZpbGVzIGluIGFsbCBjYXNlcy4KI2xvZ19y +b3RhdGlvbl9hZ2UgPSAxNDQwICAgICMgQXV0b21hdGljIHJvdGF0aW9uIG9mIGxvZ2ZpbGVzIHdp +bGwgaGFwcGVuIGFmdGVyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAjIHNvIG1hbnkgbWlu +dXRlcy4gIDAgdG8gZGlzYWJsZS4KI2xvZ19yb3RhdGlvbl9zaXplID0gMTAyNDAgICMgQXV0b21h +dGljIHJvdGF0aW9uIG9mIGxvZ2ZpbGVzIHdpbGwgaGFwcGVuIGFmdGVyCiAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAjIHNvIG1hbnkga2lsb2J5dGVzIG9mIGxvZyBvdXRwdXQuICAwIHRvIGRp +c2FibGUuCgojIFRoZXNlIGFyZSByZWxldmFudCB3aGVuIGxv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MgTE9DSyBNQU5BR0VNRU5UCiMtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KCiNkZWFkbG9ja190 +aW1lb3V0ID0gMTAwMAkjIGluIG1pbGxpc2Vjb25kcwojbWF4X2xvY2tzX3Blcl90cmFuc2FjdGlv +biA9IDY0CSMgbWluIDEwLCB+MjAwKm1heF9jb25uZWN0aW9ucyBieXRlcyBlYWNoCgoKIy0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0tLS0tLS0tLQojIFZFUlNJT04vUExBVEZPUk0gQ09NUEFUSUJJTElUWQojLS0tLS0tLS0t +LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0tLS0tCgojIC0gUHJldmlvdXMgUG9zdGdyZXMgVmVyc2lvbnMgLQoKYWRkX21pc3Npbmdf +ZnJvbSA9IGZhbHNlCiNyZWdleF9mbGF2b3IgPSBhZHZhbmNlZAkjIGFkdmFuY2VkLCBleHRlbmRl +ZCwgb3IgYmFzaWMKc3FsX2luaGVyaXRhbmNlID0gZmFsc2UKZGVmYXVsdF93aXRoX29pZHMgPSBm +YWxzZQoKIyAtIE90aGVyIFBsYXRmb3JtcyAmIENsaWVudHMgLQoKdHJhbnNmb3JtX251bGxfZXF1 +YWxzID0gZmFsc2UK + +--Multipart_Sun__17_Jul_2005_21_34_16_-0600_=WUE/07VkC53E0WZ-- + +--Signature_Sun__17_Jul_2005_21_34_16_-0600__=pJJtTXBIjc/Vrz +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iEYEARECAAYFAkLbI0oACgkQLQ/DKuwDYzlC8wCdGpe4ptr9dMB1aAED9XKcExYW +LB0An3/QkFQVuGmO+RJYcSBSRXQC6hEx +=Tro8 +-----END PGP SIGNATURE----- + +--Signature_Sun__17_Jul_2005_21_34_16_-0600__=pJJtTXBIjc/Vrz-- + +From pgsql-performance-owner@postgresql.org Mon Jul 18 00:49:06 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7129B529C9 + for ; + Mon, 18 Jul 2005 00:49:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62150-09 + for ; + Mon, 18 Jul 2005 03:48:59 +0000 (GMT) +Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) + by svr1.postgresql.org (Postfix) with ESMTP id 307EC529AE + for ; + Mon, 18 Jul 2005 00:48:35 -0300 (ADT) +Received: from ool-4353a8a5.dyn.optonline.net ([67.83.168.165] + helo=[192.168.1.102]) by outbound.mailhop.org with esmtpa (Exim 4.51) + id 1DuMcB-000Pcw-TX; Sun, 17 Jul 2005 23:48:23 -0400 +X-Mail-Handler: MailHop Outbound by DynDNS.org +X-Originating-IP: 67.83.168.165 +X-Report-Abuse-To: abuse@dyndns.org (see + http://www.mailhop.org/outbound/abuse.html for abuse reporting + information) +X-MHO-User: zeut +Message-ID: <42DB2684.9020706@zeut.net> +Date: Sun, 17 Jul 2005 23:48:20 -0400 +From: "Matthew T. O'Connor" +User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Robert Creager +Cc: PGPerformance , + Andy Hewitt +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> +In-Reply-To: <20050717213416.59dcb52e@thunder.logicalchaos.org> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/241 +X-Sequence-Number: 13482 + +Robert Creager wrote: + +>For 8.03, pg_autovacuum is running. On 7.4.1, I set up a cron job to vacuum +>analyze every 5 minutes. +> +> + +Are you sure that pg_autovacuum is doing it's job? Meaning are you sure +it's vacuuming as often as needed? Try to run it with -d2 or so and +make sure that it is actually doing the vacuuming needed. + + +From pgsql-performance-owner@postgresql.org Mon Jul 18 01:11:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 28A8A52831 + for ; + Mon, 18 Jul 2005 01:11:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71230-03 + for ; + Mon, 18 Jul 2005 04:11:02 +0000 (GMT) +Received: from rambo.iniquinet.com (rambo.iniquinet.com [69.39.89.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 4CD8252AB3 + for ; + Mon, 18 Jul 2005 01:11:01 -0300 (ADT) +Received: (qmail 4967 invoked by uid 1010); 18 Jul 2005 00:11:00 -0400 +Received: from Robert_Creager@LogicalChaos.org by rambo.iniquinet.com by uid + 1002 with qmail-scanner-1.20 (clamscan: 0.70. spamassassin: 3.0.3. + Clear:RC:0(63.147.78.131):SA:0(?/?):. + Processed in 7.168994 secs); 18 Jul 2005 04:11:00 -0000 +Received: from unknown (HELO thunder.logicalchaos.org) + (perl?test@logicalchaos.org@63.147.78.131) + by rambo.iniquinet.com with AES256-SHA encrypted SMTP; + 18 Jul 2005 00:10:53 -0400 +Received: from logicalchaos.org (thunder.logicalchaos.org [192.168.0.250]) + by thunder.logicalchaos.org (Postfix) with ESMTP id 335AA72328; + Sun, 17 Jul 2005 22:10:51 -0600 (MDT) +Date: Sun, 17 Jul 2005 22:10:50 -0600 +From: Robert Creager +To: "Matthew T. O'Connor" +Cc: PGPerformance +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +Message-ID: <20050717221050.7c4ac241@thunder.logicalchaos.org> +In-Reply-To: <42DB2684.9020706@zeut.net> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <42DB2684.9020706@zeut.net> +Organization: Starlight Vision, LLC. +X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i586-mandrake-linux-gnu) +Mime-Version: 1.0 +Content-Type: multipart/signed; + boundary=Signature_Sun__17_Jul_2005_22_10_50_-0600_f8q37Az1.H73v85v; + protocol="application/pgp-signature"; micalg=pgp-sha1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/242 +X-Sequence-Number: 13483 + +--Signature_Sun__17_Jul_2005_22_10_50_-0600_f8q37Az1.H73v85v +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: quoted-printable + + +I am, and it is. It's ANALYZING and VACUUM'ing tables every interval (5 mi= +nutes +- 8.0.3). Right now, for that last 4 hours, I'm not VACUUMing the 7.4.1 +database and it's still clicking along at < .2 second queries. Last year +(7.4.1), I noticed that it took about a week of heavy activity (for this DB) +before I'd really need a vacuum. That's when I put in the 5 min cron. + +When I first switched over to 8.0.3, I was still running the cron vacuum. = +I got +into big trouble when I had vacuum's backed up for 6 hours. That's when I +started noticing the query problem, and the CS numbers being high. 7.4.1 +vacuums every 5 minutes always take < 30 seconds (when I'm watching). + +Cheers, +Rob + +When grilled further on (Sun, 17 Jul 2005 23:48:20 -0400), +"Matthew T. O'Connor" confessed: + +> Robert Creager wrote: +>=20 +> >For 8.03, pg_autovacuum is running. On 7.4.1, I set up a cron job to va= +cuum +> >analyze every 5 minutes. +> > =20 +> > +>=20 +> Are you sure that pg_autovacuum is doing it's job? Meaning are you sure= +=20 +> it's vacuuming as often as needed? Try to run it with -d2 or so and=20 +> make sure that it is actually doing the vacuuming needed. + + +--=20 + 22:04:10 up 4 days, 1:39, 8 users, load average: 0.15, 0.15, 0.12 +Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + +--Signature_Sun__17_Jul_2005_22_10_50_-0600_f8q37Az1.H73v85v +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iEYEARECAAYFAkLbK8oACgkQLQ/DKuwDYzkVfwCeI8iUFCNmJVfDnsaZBFeqfeo0 +qG4AnjdzMJIaPcEqnwebel07bsMSFgnd +=RdSZ +-----END PGP SIGNATURE----- + +--Signature_Sun__17_Jul_2005_22_10_50_-0600_f8q37Az1.H73v85v-- + +From pgsql-performance-owner@postgresql.org Mon Jul 18 01:11:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3CBDE5286E + for ; + Mon, 18 Jul 2005 01:11:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67568-08 + for ; + Mon, 18 Jul 2005 04:11:05 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B25F152AB9 + for ; + Mon, 18 Jul 2005 01:11:01 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6I4Arx9024521; + Mon, 18 Jul 2005 00:10:53 -0400 (EDT) +To: Robert Creager +Cc: PGPerformance , + Andy Hewitt +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS issue? +In-reply-to: <20050717213416.59dcb52e@thunder.logicalchaos.org> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> +Comments: In-reply-to Robert Creager + message dated "Sun, 17 Jul 2005 21:34:16 -0600" +Date: Mon, 18 Jul 2005 00:10:53 -0400 +Message-ID: <24520.1121659853@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/243 +X-Sequence-Number: 13484 + +Robert Creager writes: +> I'm guessing this is the CS problem that reared it's head last year? + +The context swap problem was no worse in 8.0 than in prior versions, +so that hardly seems like a good explanation. Have you tried reverting +to the cron-based vacuuming method you used in 7.4? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 18 01:18:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AC6DD52A90 + for ; + Mon, 18 Jul 2005 01:18:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 72432-07 + for ; + Mon, 18 Jul 2005 04:18:09 +0000 (GMT) +Received: from smtp003.bizmail.yahoo.com (smtp003.bizmail.yahoo.com + [216.136.130.195]) + by svr1.postgresql.org (Postfix) with SMTP id D2AA352831 + for ; + Mon, 18 Jul 2005 01:18:08 -0300 (ADT) +Received: (qmail 25448 invoked from network); 18 Jul 2005 04:18:07 -0000 +Received: from unknown (HELO ?192.168.3.41?) + (david.mitchell@telogis.com@203.98.10.169 with plain) + by smtp003.bizmail.yahoo.com with SMTP; 18 Jul 2005 04:18:07 -0000 +Message-ID: <42DB2D72.8090401@telogis.com> +Date: Mon, 18 Jul 2005 16:17:54 +1200 +From: David Mitchell +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Robert Creager +Cc: "Matthew T. O'Connor" , + PGPerformance +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <42DB2684.9020706@zeut.net> + <20050717221050.7c4ac241@thunder.logicalchaos.org> +In-Reply-To: <20050717221050.7c4ac241@thunder.logicalchaos.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-Archive-Number: 200507/244 +X-Sequence-Number: 13485 + +Sounds like either someone is holding a lock on your pg8 db, or maybe +you need a vacuum full. No amount of normal vacuuming will fix a table +that needs a vacuum full. Although if that were the case I'd expect you +to have slow queries regardless of the number of concurrent connections. +Maybe you should check who is holding locks. + +David + +Robert Creager wrote: +> I am, and it is. It's ANALYZING and VACUUM'ing tables every interval (5 minutes +> - 8.0.3). Right now, for that last 4 hours, I'm not VACUUMing the 7.4.1 +> database and it's still clicking along at < .2 second queries. Last year +> (7.4.1), I noticed that it took about a week of heavy activity (for this DB) +> before I'd really need a vacuum. That's when I put in the 5 min cron. +> +> When I first switched over to 8.0.3, I was still running the cron vacuum. I got +> into big trouble when I had vacuum's backed up for 6 hours. That's when I +> started noticing the query problem, and the CS numbers being high. 7.4.1 +> vacuums every 5 minutes always take < 30 seconds (when I'm watching). +> +> Cheers, +> Rob +> +> When grilled further on (Sun, 17 Jul 2005 23:48:20 -0400), +> "Matthew T. O'Connor" confessed: +> +> +>>Robert Creager wrote: +>> +>> +>>>For 8.03, pg_autovacuum is running. On 7.4.1, I set up a cron job to vacuum +>>>analyze every 5 minutes. +>>> +>>> +>> +>>Are you sure that pg_autovacuum is doing it's job? Meaning are you sure +>>it's vacuuming as often as needed? Try to run it with -d2 or so and +>>make sure that it is actually doing the vacuuming needed. +> +> +> + + +-- +David Mitchell +Software Engineer +Telogis + + +From pgsql-performance-owner@postgresql.org Mon Jul 18 01:18:45 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6FE5352865 + for ; + Mon, 18 Jul 2005 01:18:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75293-01 + for ; + Mon, 18 Jul 2005 04:18:34 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2FD1E52A90 + for ; + Mon, 18 Jul 2005 01:18:33 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6I4IU4s024617; + Mon, 18 Jul 2005 00:18:30 -0400 (EDT) +To: Robert Creager +Cc: "Matthew T. O'Connor" , + PGPerformance +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +In-reply-to: <20050717221050.7c4ac241@thunder.logicalchaos.org> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <42DB2684.9020706@zeut.net> + <20050717221050.7c4ac241@thunder.logicalchaos.org> +Comments: In-reply-to Robert Creager + message dated "Sun, 17 Jul 2005 22:10:50 -0600" +Date: Mon, 18 Jul 2005 00:18:30 -0400 +Message-ID: <24616.1121660310@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/245 +X-Sequence-Number: 13486 + +Robert Creager writes: +> I am, and it is. It's ANALYZING and VACUUM'ing tables every interval (5 mi= +> nutes +> - 8.0.3). Right now, for that last 4 hours, I'm not VACUUMing the 7.4.1 +> database and it's still clicking along at < .2 second queries. + +Have you compared physical table sizes? If the autovac daemon did let +things get out of hand, you'd need a VACUUM FULL or CLUSTER or TRUNCATE +to get the table size back down --- plain VACUUM is unlikely to fix it. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 18 01:18:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 34B1152A21 + for ; + Mon, 18 Jul 2005 01:18:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75195-03 + for ; + Mon, 18 Jul 2005 04:18:46 +0000 (GMT) +Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) + by svr1.postgresql.org (Postfix) with ESMTP id CC00E52A0D + for ; + Mon, 18 Jul 2005 01:18:45 -0300 (ADT) +Received: from ool-4353a8a5.dyn.optonline.net ([67.83.168.165] + helo=[192.168.1.102]) by outbound.mailhop.org with esmtpa (Exim 4.51) + id 1DuN5Y-0006qL-8G; Mon, 18 Jul 2005 00:18:44 -0400 +X-Mail-Handler: MailHop Outbound by DynDNS.org +X-Originating-IP: 67.83.168.165 +X-Report-Abuse-To: abuse@dyndns.org (see + http://www.mailhop.org/outbound/abuse.html for abuse reporting + information) +X-MHO-User: zeut +Message-ID: <42DB2DA3.6000909@zeut.net> +Date: Mon, 18 Jul 2005 00:18:43 -0400 +From: "Matthew T. O'Connor" +User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Robert Creager +Cc: PGPerformance +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <42DB2684.9020706@zeut.net> + <20050717221050.7c4ac241@thunder.logicalchaos.org> +In-Reply-To: <20050717221050.7c4ac241@thunder.logicalchaos.org> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/246 +X-Sequence-Number: 13487 + +Ok, it doesn't look like an autovacuum problem. The only other thing I +can think of is that some query is doing a seq scan rather than an index +scan. Have you turned on the query logging to see what queries are +taking so long? + +Matt + + +Robert Creager wrote: + +>I am, and it is. It's ANALYZING and VACUUM'ing tables every interval (5 minutes +>- 8.0.3). Right now, for that last 4 hours, I'm not VACUUMing the 7.4.1 +>database and it's still clicking along at < .2 second queries. Last year +>(7.4.1), I noticed that it took about a week of heavy activity (for this DB) +>before I'd really need a vacuum. That's when I put in the 5 min cron. +> +>When I first switched over to 8.0.3, I was still running the cron vacuum. I got +>into big trouble when I had vacuum's backed up for 6 hours. That's when I +>started noticing the query problem, and the CS numbers being high. 7.4.1 +>vacuums every 5 minutes always take < 30 seconds (when I'm watching). +> +>Cheers, +>Rob +> +>When grilled further on (Sun, 17 Jul 2005 23:48:20 -0400), +>"Matthew T. O'Connor" confessed: +> +> +> +>>Robert Creager wrote: +>> +>> +>> +>>>For 8.03, pg_autovacuum is running. On 7.4.1, I set up a cron job to vacuum +>>>analyze every 5 minutes. +>>> +>>> +>>> +>>> +>>Are you sure that pg_autovacuum is doing it's job? Meaning are you sure +>>it's vacuuming as often as needed? Try to run it with -d2 or so and +>>make sure that it is actually doing the vacuuming needed. +>> +>> +> +> +> +> + + +From pgsql-performance-owner@postgresql.org Mon Jul 18 01:33:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 72ACE52AE5 + for ; + Mon, 18 Jul 2005 01:33:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74721-08 + for ; + Mon, 18 Jul 2005 04:33:05 +0000 (GMT) +Received: from rambo.iniquinet.com (rambo.iniquinet.com [69.39.89.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 3C2EA52AD4 + for ; + Mon, 18 Jul 2005 01:33:04 -0300 (ADT) +Received: (qmail 20635 invoked by uid 1010); 18 Jul 2005 00:33:04 -0400 +Received: from Robert_Creager@LogicalChaos.org by rambo.iniquinet.com by uid + 1002 with qmail-scanner-1.20 (clamscan: 0.70. spamassassin: 3.0.3. + Clear:RC:0(63.147.78.131):SA:0(?/?):. + Processed in 1.892918 secs); 18 Jul 2005 04:33:04 -0000 +Received: from unknown (HELO thunder.logicalchaos.org) + (perl?test@logicalchaos.org@63.147.78.131) + by rambo.iniquinet.com with AES256-SHA encrypted SMTP; + 18 Jul 2005 00:33:02 -0400 +Received: from logicalchaos.org (thunder.logicalchaos.org [192.168.0.250]) + by thunder.logicalchaos.org (Postfix) with ESMTP id 39C97B31D3; + Sun, 17 Jul 2005 22:33:00 -0600 (MDT) +Date: Sun, 17 Jul 2005 22:32:59 -0600 +From: Robert Creager +To: "Matthew T. O'Connor" +Cc: PGPerformance +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +Message-ID: <20050717223259.4eca3b8c@thunder.logicalchaos.org> +In-Reply-To: <42DB2DA3.6000909@zeut.net> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <42DB2684.9020706@zeut.net> + <20050717221050.7c4ac241@thunder.logicalchaos.org> + <42DB2DA3.6000909@zeut.net> +Organization: Starlight Vision, LLC. +X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i586-mandrake-linux-gnu) +Mime-Version: 1.0 +Content-Type: multipart/signed; + boundary="Signature_Sun__17_Jul_2005_22_32_59_-0600_=FG.4ymlW8TtsHIL"; + protocol="application/pgp-signature"; micalg=pgp-sha1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/247 +X-Sequence-Number: 13488 + +--Signature_Sun__17_Jul_2005_22_32_59_-0600_=FG.4ymlW8TtsHIL +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: quoted-printable + +When grilled further on (Mon, 18 Jul 2005 00:18:43 -0400), +"Matthew T. O'Connor" confessed: + +> Have you turned on the query logging to see what queries are=20 +> taking so long? +>=20 + +Yeah. In the original message is a typical query. One from 741 and the ot= +her +on 803. On 803, an explain analyze is done twice. Once during the problem, +once when the system is idle. On 741, the query behaves the same no matter +what... + +Cheers, +Rob + +--=20 + 22:31:18 up 4 days, 2:06, 8 users, load average: 0.25, 0.18, 0.11 +Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + +--Signature_Sun__17_Jul_2005_22_32_59_-0600_=FG.4ymlW8TtsHIL +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iEYEARECAAYFAkLbMPsACgkQLQ/DKuwDYzkCpwCgjzwS/ibdEN9d3LAfY3gKRDfD +srsAnj3K7fWvN3TADjH9FI2TCzV2ZZp9 +=2ZIa +-----END PGP SIGNATURE----- + +--Signature_Sun__17_Jul_2005_22_32_59_-0600_=FG.4ymlW8TtsHIL-- + +From pgsql-performance-owner@postgresql.org Mon Jul 18 02:02:25 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2979352AEB + for ; + Mon, 18 Jul 2005 02:02:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 86627-04 + for ; + Mon, 18 Jul 2005 05:02:12 +0000 (GMT) +Received: from rambo.iniquinet.com (rambo.iniquinet.com [69.39.89.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 4E72052831 + for ; + Mon, 18 Jul 2005 02:02:11 -0300 (ADT) +Received: (qmail 29973 invoked by uid 1010); 18 Jul 2005 01:02:11 -0400 +Received: from Robert_Creager@LogicalChaos.org by rambo.iniquinet.com by uid + 1002 with qmail-scanner-1.20 (clamscan: 0.70. spamassassin: 3.0.3. + Clear:RC:0(63.147.78.131):SA:0(?/?):. + Processed in 1.083139 secs); 18 Jul 2005 05:02:11 -0000 +Received: from unknown (HELO thunder.logicalchaos.org) + (perl?test@logicalchaos.org@63.147.78.131) + by rambo.iniquinet.com with AES256-SHA encrypted SMTP; + 18 Jul 2005 01:02:09 -0400 +Received: from logicalchaos.org (thunder.logicalchaos.org [192.168.0.250]) + by thunder.logicalchaos.org (Postfix) with ESMTP id 8CC6D311CE; + Sun, 17 Jul 2005 23:02:08 -0600 (MDT) +Date: Sun, 17 Jul 2005 23:02:08 -0600 +From: Robert Creager +To: David Mitchell +Cc: "Matthew T. O'Connor" , + PGPerformance +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +Message-ID: <20050717230208.6b6c319d@thunder.logicalchaos.org> +In-Reply-To: <42DB2D72.8090401@telogis.com> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <42DB2684.9020706@zeut.net> + <20050717221050.7c4ac241@thunder.logicalchaos.org> + <42DB2D72.8090401@telogis.com> +Organization: Starlight Vision, LLC. +X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i586-mandrake-linux-gnu) +Mime-Version: 1.0 +Content-Type: multipart/signed; + boundary="Signature_Sun__17_Jul_2005_23_02_08_-0600_AvgBjWTU=k=9Ss+E"; + protocol="application/pgp-signature"; micalg=pgp-sha1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/248 +X-Sequence-Number: 13489 + +--Signature_Sun__17_Jul_2005_23_02_08_-0600_AvgBjWTU=k=9Ss+E +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: quoted-printable + +When grilled further on (Mon, 18 Jul 2005 16:17:54 +1200), +David Mitchell confessed: + +> Maybe you should check who is holding locks. + +Hmmm... The only difference is how the vacuum is run. One by autovacuum, = +one +by cron (vacuum analyze every 5 minutes). + +Cheers, +Rob + +--=20 + 23:01:44 up 4 days, 2:36, 6 users, load average: 0.27, 0.16, 0.10 +Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + +--Signature_Sun__17_Jul_2005_23_02_08_-0600_AvgBjWTU=k=9Ss+E +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iEYEARECAAYFAkLbN9AACgkQLQ/DKuwDYznUzACdEf6SIy9mgrMHjZ5sgqNyj8O0 +V4MAniyDViWlBoQ1DxWlDiErWOzl365c +=3Xah +-----END PGP SIGNATURE----- + +--Signature_Sun__17_Jul_2005_23_02_08_-0600_AvgBjWTU=k=9Ss+E-- + +From pgsql-performance-owner@postgresql.org Mon Jul 18 02:09:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3FBB452AEB + for ; + Mon, 18 Jul 2005 02:09:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87060-02 + for ; + Mon, 18 Jul 2005 05:08:58 +0000 (GMT) +Received: from mail22.sea5.speakeasy.net (mail22.sea5.speakeasy.net + [69.17.117.24]) + by svr1.postgresql.org (Postfix) with ESMTP id A923D52831 + for ; + Mon, 18 Jul 2005 02:08:56 -0300 (ADT) +Received: (qmail 30001 invoked from network); 18 Jul 2005 05:08:56 -0000 +Received: from dsl081-060-184.sfo1.dsl.speakeasy.net (HELO noodles) + ([64.81.60.184]) (envelope-sender ) + by mail22.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP + for ; 18 Jul 2005 05:08:56 -0000 +Received: from jwb by noodles with local (Exim 3.36 #1 (Debian)) + id 1DuNsO-0002sS-00; Sun, 17 Jul 2005 22:09:12 -0700 +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - +From: "Jeffrey W. Baker" +To: Robert Creager +Cc: PGPerformance , + Andy Hewitt +In-Reply-To: <20050717213416.59dcb52e@thunder.logicalchaos.org> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Date: Sun, 17 Jul 2005 22:09:11 -0700 +Message-Id: <1121663351.10108.1.camel@noodles> +Mime-Version: 1.0 +X-Mailer: Evolution 2.3.5.1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/249 +X-Sequence-Number: 13490 + +On Sun, 2005-07-17 at 21:34 -0600, Robert Creager wrote: +> Sigh... +> +> I recently upgraded from 7.4.1 to 8.0.3. The application did not change. I'm +> now running both database concurrently (on different ports, same machine) just +> so I could verify the problem really exists. +> +> The application is a custom test application for testing mechanical systems. +> The runs in question (4 at a time) each generate 16 queries at a time of which +> the results are sent to the mechanical system which processes the request, which +> processes them anywhere from 10 to 120 seconds. The system is capable of +> completing between 4 and 8 jobs at once. So, once the system is running, at +> most there will be 8 queries per run simultaneously. +> +> The entire database fits into RAM (2Gb), as evidenced by no disk activity and +> relatively small database size. pg_xlog is on different disks from the db. +> +> The problem is that on version 8.0.3, once I get 3 or more concurrent runs +> going, the query times start tanking (>20 seconds). On 7.4.1, the applications +> hum along with queries typically below .2 seconds on over 5 concurrent runs. +> Needless to say, 7.4.1 behaves as expected... The only change between runs is +> the port connecting to. Bot DB's are up at the same time. +> +> For 8.03, pg_autovacuum is running. On 7.4.1, I set up a cron job to vacuum +> analyze every 5 minutes. +> +> The system is Mandrake Linux running 2.4.22 kernel with dual Intel Xenon CPU +> with HT enabled. On an 803 run, the context switching is up around 60k. On +> 7.4.1, it maxes around 23k and averages < 1k. + +Did you build 8.0.3 yourself, or install it from packages? I've seen in +the past where pg would build with the wrong kind of mutexes on some +machines, and that would send the CS through the roof. If you did build +it yourself, check your ./configure logs. If not, try strace. + +-jwb + +From pgsql-performance-owner@postgresql.org Mon Jul 18 02:09:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 26A9F52831 + for ; + Mon, 18 Jul 2005 02:09:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83890-09 + for ; + Mon, 18 Jul 2005 05:09:20 +0000 (GMT) +Received: from rambo.iniquinet.com (rambo.iniquinet.com [69.39.89.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 09D0252AFA + for ; + Mon, 18 Jul 2005 02:09:19 -0300 (ADT) +Received: (qmail 32175 invoked by uid 1010); 18 Jul 2005 01:09:20 -0400 +Received: from Robert_Creager@LogicalChaos.org by rambo.iniquinet.com by uid + 1002 with qmail-scanner-1.20 (clamscan: 0.70. spamassassin: 3.0.3. + Clear:RC:0(63.147.78.131):SA:0(?/?):. + Processed in 1.110409 secs); 18 Jul 2005 05:09:20 -0000 +Received: from unknown (HELO thunder.logicalchaos.org) + (perl?test@logicalchaos.org@63.147.78.131) + by rambo.iniquinet.com with AES256-SHA encrypted SMTP; + 18 Jul 2005 01:09:18 -0400 +Received: from logicalchaos.org (thunder.logicalchaos.org [192.168.0.250]) + by thunder.logicalchaos.org (Postfix) with ESMTP id 9B4DA311CE; + Sun, 17 Jul 2005 23:09:12 -0600 (MDT) +Date: Sun, 17 Jul 2005 23:09:12 -0600 +From: Robert Creager +To: Tom Lane +Cc: PGPerformance , + Andy Hewitt +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +Message-ID: <20050717230912.12d51ec9@thunder.logicalchaos.org> +In-Reply-To: <24520.1121659853@sss.pgh.pa.us> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <24520.1121659853@sss.pgh.pa.us> +Organization: Starlight Vision, LLC. +X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i586-mandrake-linux-gnu) +Mime-Version: 1.0 +Content-Type: multipart/signed; + boundary=Signature_Sun__17_Jul_2005_23_09_12_-0600_Rpg7oL+V5OnpZbJ.; + protocol="application/pgp-signature"; micalg=pgp-sha1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/250 +X-Sequence-Number: 13491 + +--Signature_Sun__17_Jul_2005_23_09_12_-0600_Rpg7oL+V5OnpZbJ. +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: quoted-printable + +When grilled further on (Mon, 18 Jul 2005 00:10:53 -0400), +Tom Lane confessed: + +> Have you tried reverting +> to the cron-based vacuuming method you used in 7.4? +>=20 + +I just stopped autovacuum, ran a manual vacuum analyze on 803 (2064 pages +needed, 8000000 FSM setting) and re-started the run (with cron vac enabled)= +.=20 +The query problem has not showed up yet (1/2 hour). A vacuum on 741 showed= + 3434 +pages needed, 200000 FSM setting. + +I'll let it run the night and see if it shows up after a couple of hours. = +It +has run clean for 1 hour prior. If this runs 'till morning, I'll re-enable= + the +autovacuum, disable the cron and see if it reproduces itself (the slowdown). + +Cheers, +Rob + +--=20 + 22:18:40 up 4 days, 1:53, 8 users, load average: 0.10, 0.20, 0.14 +Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + +--Signature_Sun__17_Jul_2005_23_09_12_-0600_Rpg7oL+V5OnpZbJ. +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iEYEARECAAYFAkLbOXgACgkQLQ/DKuwDYznSGwCbBWYsuWu4EBxxx8LU2GWY0t4T +T9YAnRhBjfYSAVvq3RkaR7jQWnWpyU5J +=VwCW +-----END PGP SIGNATURE----- + +--Signature_Sun__17_Jul_2005_23_09_12_-0600_Rpg7oL+V5OnpZbJ.-- + +From pgsql-performance-owner@postgresql.org Mon Jul 18 02:27:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9633152B0A + for ; + Mon, 18 Jul 2005 02:27:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88157-05 + for ; + Mon, 18 Jul 2005 05:27:11 +0000 (GMT) +Received: from rambo.iniquinet.com (rambo.iniquinet.com [69.39.89.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A7BE52AED + for ; + Mon, 18 Jul 2005 02:27:11 -0300 (ADT) +Received: (qmail 5148 invoked by uid 1010); 18 Jul 2005 01:27:12 -0400 +Received: from Robert_Creager@LogicalChaos.org by rambo.iniquinet.com by uid + 1002 with qmail-scanner-1.20 (clamscan: 0.70. spamassassin: 3.0.3. + Clear:RC:0(63.147.78.131):SA:0(?/?):. + Processed in 1.583789 secs); 18 Jul 2005 05:27:12 -0000 +Received: from unknown (HELO thunder.logicalchaos.org) + (perl?test@logicalchaos.org@63.147.78.131) + by rambo.iniquinet.com with AES256-SHA encrypted SMTP; + 18 Jul 2005 01:27:10 -0400 +Received: from logicalchaos.org (thunder.logicalchaos.org [192.168.0.250]) + by thunder.logicalchaos.org (Postfix) with ESMTP id DDBF772328; + Sun, 17 Jul 2005 23:27:08 -0600 (MDT) +Date: Sun, 17 Jul 2005 23:27:08 -0600 +From: Robert Creager +To: "Jeffrey W. Baker" +Cc: Robert Creager , + PGPerformance , + Andy Hewitt +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +Message-ID: <20050717232708.382bb715@thunder.logicalchaos.org> +In-Reply-To: <1121663351.10108.1.camel@noodles> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <1121663351.10108.1.camel@noodles> +Organization: Starlight Vision, LLC. +X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i586-mandrake-linux-gnu) +Mime-Version: 1.0 +Content-Type: multipart/signed; + boundary="Signature_Sun__17_Jul_2005_23_27_08_-0600_aqD+2JK2Qri3H/mX"; + protocol="application/pgp-signature"; micalg=pgp-sha1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/251 +X-Sequence-Number: 13492 + +--Signature_Sun__17_Jul_2005_23_27_08_-0600_aqD+2JK2Qri3H/mX +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: quoted-printable + +When grilled further on (Sun, 17 Jul 2005 22:09:11 -0700), +"Jeffrey W. Baker" confessed: + +>=20 +> Did you build 8.0.3 yourself, or install it from packages? I've seen in +> the past where pg would build with the wrong kind of mutexes on some +> machines, and that would send the CS through the roof. If you did build +> it yourself, check your ./configure logs. If not, try strace. + +I always build PG from source. I did check the config.log command line +(./configure) and they were similar enough. The system has not changed bet= +ween +building the two versions (if it ain't broke...). + +Cheers, +Rob + +--=20 + 23:25:21 up 4 days, 3:00, 6 users, load average: 0.25, 0.15, 0.11 +Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + +--Signature_Sun__17_Jul_2005_23_27_08_-0600_aqD+2JK2Qri3H/mX +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iEYEARECAAYFAkLbPawACgkQLQ/DKuwDYzn38ACgmY+9GhBnWSolj8/ju3/UNvRG +pm4AnRw7hD7Agm1/KLLQ4d8awLjdT+lq +=11o7 +-----END PGP SIGNATURE----- + +--Signature_Sun__17_Jul_2005_23_27_08_-0600_aqD+2JK2Qri3H/mX-- + +From pgsql-performance-owner@postgresql.org Mon Jul 18 02:43:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1438E52AF8 + for ; + Mon, 18 Jul 2005 02:43:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94280-02 + for ; + Mon, 18 Jul 2005 05:43:32 +0000 (GMT) +Received: from rambo.iniquinet.com (rambo.iniquinet.com [69.39.89.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 113ED52AE1 + for ; + Mon, 18 Jul 2005 02:43:31 -0300 (ADT) +Received: (qmail 9280 invoked by uid 1010); 18 Jul 2005 01:43:32 -0400 +Received: from Robert_Creager@LogicalChaos.org by rambo.iniquinet.com by uid + 1002 with qmail-scanner-1.20 (clamscan: 0.70. spamassassin: 3.0.3. + Clear:RC:0(63.147.78.131):SA:0(?/?):. + Processed in 1.237431 secs); 18 Jul 2005 05:43:32 -0000 +Received: from unknown (HELO thunder.logicalchaos.org) + (perl?test@logicalchaos.org@63.147.78.131) + by rambo.iniquinet.com with AES256-SHA encrypted SMTP; + 18 Jul 2005 01:43:30 -0400 +Received: from logicalchaos.org (thunder.logicalchaos.org [192.168.0.250]) + by thunder.logicalchaos.org (Postfix) with ESMTP id 64FE4311CE; + Sun, 17 Jul 2005 23:43:29 -0600 (MDT) +Date: Sun, 17 Jul 2005 23:43:29 -0600 +From: Robert Creager +To: Tom Lane +Cc: "Matthew T. O'Connor" , + PGPerformance +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +Message-ID: <20050717234329.05ce2e52@thunder.logicalchaos.org> +In-Reply-To: <24616.1121660310@sss.pgh.pa.us> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <42DB2684.9020706@zeut.net> + <20050717221050.7c4ac241@thunder.logicalchaos.org> + <24616.1121660310@sss.pgh.pa.us> +Organization: Starlight Vision, LLC. +X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i586-mandrake-linux-gnu) +Mime-Version: 1.0 +Content-Type: multipart/signed; + boundary=Signature_Sun__17_Jul_2005_23_43_29_-0600_z2HHaZ2Lg_vObEHB; + protocol="application/pgp-signature"; micalg=pgp-sha1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/252 +X-Sequence-Number: 13493 + +--Signature_Sun__17_Jul_2005_23_43_29_-0600_z2HHaZ2Lg_vObEHB +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: quoted-printable + +When grilled further on (Mon, 18 Jul 2005 00:18:30 -0400), +Tom Lane confessed: + +> Robert Creager writes: +> > I am, and it is. It's ANALYZING and VACUUM'ing tables every interval (= +5 mi=3D +> > nutes +> > - 8.0.3). Right now, for that last 4 hours, I'm not VACUUMing the 7.4.1 +> > database and it's still clicking along at < .2 second queries. +>=20 +> Have you compared physical table sizes? If the autovac daemon did let +> things get out of hand, you'd need a VACUUM FULL or CLUSTER or TRUNCATE +> to get the table size back down --- plain VACUUM is unlikely to fix it. + +Table sizes, no. Entire DB size is 45Mb for 803 and 29Mb for 741. Cannot = +make +a direct comparison between the two as I've run against more machines now w= +ith +803 than 741, so I'd expect it to be larger. + +I'm still running relatively clean on 803 with cron vacuum. The CS are jum= +ping +from 100 to 120k, but it's not steady state like it was before, and queries= + are +all under 5 seconds (none hitting the logs) and are typically (glancing at = +test +runs) still under 1 sec, with some hitting ~2 seconds occasionally. + +I've 6 runs going concurrently. Just saw (vmstat 1) a set of 8 seconds whe= +re +the CS didn't drop below 90k, but right now its at ~300 for over 30 seconds= +...=20 +It's bouncing all over the place, but staying reasonably well behaved overa= +ll. + +Whoop. Spoke too soon. Just hit the wall. CS at ~80k constant, queries o= +ver +10 seconds and rising (30+ now)... Looking at ps, the vacuum is currently +running. Going back in the logs, the CS and vacuum hit at about the same t= +ime. + +I'm going to go back to 741 with the same load and see what happens by tomo= +rrow +morning... I'll change the cron vac to hit the 741 db. + +Cheers, +Rob + +--=20 + 23:29:24 up 4 days, 3:04, 6 users, load average: 0.02, 0.07, 0.08 +Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + +--Signature_Sun__17_Jul_2005_23_43_29_-0600_z2HHaZ2Lg_vObEHB +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iEYEARECAAYFAkLbQYEACgkQLQ/DKuwDYzn8MgCfSWOcbx4kPIaeGUaDpA5t8nF3 +newAn3/EzLgp9ysUXGL8S4/CUWKDDCvw +=znj8 +-----END PGP SIGNATURE----- + +--Signature_Sun__17_Jul_2005_23_43_29_-0600_z2HHaZ2Lg_vObEHB-- + +From pgsql-performance-owner@postgresql.org Mon Jul 18 02:56:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BD6A152AA6 + for ; + Mon, 18 Jul 2005 02:56:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96888-02 + for ; + Mon, 18 Jul 2005 05:56:34 +0000 (GMT) +Received: from rambo.iniquinet.com (rambo.iniquinet.com [69.39.89.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 8F69552A73 + for ; + Mon, 18 Jul 2005 02:56:33 -0300 (ADT) +Received: (qmail 12607 invoked by uid 1010); 18 Jul 2005 01:56:33 -0400 +Received: from Robert_Creager@LogicalChaos.org by rambo.iniquinet.com by uid + 1002 with qmail-scanner-1.20 (clamscan: 0.70. spamassassin: 3.0.3. + Clear:RC:0(63.147.78.131):SA:0(?/?):. + Processed in 1.2516 secs); 18 Jul 2005 05:56:33 -0000 +Received: from unknown (HELO thunder.logicalchaos.org) + (perl?test@logicalchaos.org@63.147.78.131) + by rambo.iniquinet.com with AES256-SHA encrypted SMTP; + 18 Jul 2005 01:56:31 -0400 +Received: from logicalchaos.org (thunder.logicalchaos.org [192.168.0.250]) + by thunder.logicalchaos.org (Postfix) with ESMTP id 7DBBD72328; + Sun, 17 Jul 2005 23:56:30 -0600 (MDT) +Date: Sun, 17 Jul 2005 23:56:30 -0600 +From: Robert Creager +To: Tom Lane +Cc: PGPerformance , + Andy Hewitt +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +Message-ID: <20050717235630.26a7c979@thunder.logicalchaos.org> +In-Reply-To: <24520.1121659853@sss.pgh.pa.us> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <24520.1121659853@sss.pgh.pa.us> +Organization: Starlight Vision, LLC. +X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i586-mandrake-linux-gnu) +Mime-Version: 1.0 +Content-Type: multipart/signed; + boundary="Signature_Sun__17_Jul_2005_23_56_30_-0600_qOYAQc/dgQEn9yoa"; + protocol="application/pgp-signature"; micalg=pgp-sha1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/253 +X-Sequence-Number: 13494 + +--Signature_Sun__17_Jul_2005_23_56_30_-0600_qOYAQc/dgQEn9yoa +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: quoted-printable + +When grilled further on (Mon, 18 Jul 2005 00:10:53 -0400), +Tom Lane confessed: + +> The context swap problem was no worse in 8.0 than in prior versions, +> so that hardly seems like a good explanation. Have you tried reverting +> to the cron-based vacuuming method you used in 7.4? +>=20 + +I've "vacuum_cost_delay =3D 10" in the conf file for 803. hit, miss, dirty= + and +limit are 1, 10, 20 and 200 respectively. Could that be contributing to the +problem? I'll know more in an hour or so with 741 running and cron vac and= + the +same load. + +Cheers, +Rob + +--=20 + 23:53:53 up 4 days, 3:28, 6 users, load average: 0.11, 0.13, 0.11 +Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + +--Signature_Sun__17_Jul_2005_23_56_30_-0600_qOYAQc/dgQEn9yoa +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iEYEARECAAYFAkLbRI4ACgkQLQ/DKuwDYzko9QCeLnwlPcHVNLWZITxl/CXdIZQm +pyAAn2pAlqiWxpXlb/B4A+O1mG8HnVOf +=TwF/ +-----END PGP SIGNATURE----- + +--Signature_Sun__17_Jul_2005_23_56_30_-0600_qOYAQc/dgQEn9yoa-- + +From pgsql-performance-owner@postgresql.org Mon Jul 18 03:07:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 404BF52806 + for ; + Mon, 18 Jul 2005 03:07:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95312-06 + for ; + Mon, 18 Jul 2005 06:07:18 +0000 (GMT) +Received: from rambo.iniquinet.com (rambo.iniquinet.com [69.39.89.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 2735E52C6F + for ; + Mon, 18 Jul 2005 03:07:17 -0300 (ADT) +Received: (qmail 15688 invoked by uid 1010); 18 Jul 2005 02:07:17 -0400 +Received: from Robert_Creager@LogicalChaos.org by rambo.iniquinet.com by uid + 1002 with qmail-scanner-1.20 (clamscan: 0.70. spamassassin: 3.0.3. + Clear:RC:0(63.147.78.131):SA:0(?/?):. + Processed in 2.472975 secs); 18 Jul 2005 06:07:17 -0000 +Received: from unknown (HELO thunder.logicalchaos.org) + (perl?test@logicalchaos.org@63.147.78.131) + by rambo.iniquinet.com with AES256-SHA encrypted SMTP; + 18 Jul 2005 02:07:15 -0400 +Received: from logicalchaos.org (thunder.logicalchaos.org [192.168.0.250]) + by thunder.logicalchaos.org (Postfix) with ESMTP id D1C4B3EA42; + Mon, 18 Jul 2005 00:07:13 -0600 (MDT) +Date: Mon, 18 Jul 2005 00:07:13 -0600 +From: Robert Creager +To: Robert Creager +Cc: Tom Lane , "Matthew T. O'Connor" , + PGPerformance +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +Message-ID: <20050718000713.3366dad9@thunder.logicalchaos.org> +In-Reply-To: <20050717234329.05ce2e52@thunder.logicalchaos.org> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <42DB2684.9020706@zeut.net> + <20050717221050.7c4ac241@thunder.logicalchaos.org> + <24616.1121660310@sss.pgh.pa.us> + <20050717234329.05ce2e52@thunder.logicalchaos.org> +Organization: Starlight Vision, LLC. +X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i586-mandrake-linux-gnu) +Mime-Version: 1.0 +Content-Type: multipart/signed; + boundary="Signature_Mon__18_Jul_2005_00_07_13_-0600_yzEq77=SL24n3HxN"; + protocol="application/pgp-signature"; micalg=pgp-sha1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/254 +X-Sequence-Number: 13495 + +--Signature_Mon__18_Jul_2005_00_07_13_-0600_yzEq77=SL24n3HxN +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: quoted-printable + +When grilled further on (Sun, 17 Jul 2005 23:43:29 -0600), +Robert Creager confessed: + +> I've 6 runs going concurrently. Just saw (vmstat 1) a set of 8 seconds w= +here +> the CS didn't drop below 90k, but right now its at ~300 for over 30 secon= +ds... + +> It's bouncing all over the place, but staying reasonably well behaved ove= +rall. +>=20 + +Against 741 and the same load, CS is steady around 300 with spikes up to 4k= +, but +it's only been running for about 15 minutes. All queries are < .2 seconds. + +Cheers, +Rob + +--=20 + 00:03:33 up 4 days, 3:38, 6 users, load average: 1.67, 0.98, 0.44 +Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + +--Signature_Mon__18_Jul_2005_00_07_13_-0600_yzEq77=SL24n3HxN +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iEYEARECAAYFAkLbRxEACgkQLQ/DKuwDYzkjjQCgggOf7Bx5Bg+btMrJQ5Cr2EQB +rXYAni1EOPZDVsHyTUz7itBv0htio6jE +=VZSz +-----END PGP SIGNATURE----- + +--Signature_Mon__18_Jul_2005_00_07_13_-0600_yzEq77=SL24n3HxN-- + +From pgsql-performance-owner@postgresql.org Mon Jul 18 04:51:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3064C52C80 + for ; + Mon, 18 Jul 2005 04:51:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20466-08 + for ; + Mon, 18 Jul 2005 07:51:41 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.200]) + by svr1.postgresql.org (Postfix) with ESMTP id CB33952C7F + for ; + Mon, 18 Jul 2005 04:51:39 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id i11so818446nzh + for ; + Mon, 18 Jul 2005 00:51:41 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=Sd+AwLmS/DrRJCR9gMHYldjQyCHPHwtwJihIExzVpY3aIpAPAoHMZ/CnweHLU9Ecek41TcKQ59XXNH8bEDurlZpwGUpWFDobjHrmRKkhmC/HVUQsasoUWwImVMlrOV5oW9ae5f4xih9oYgStlBjEieX4jgPHP3GCQu0LUed3aLg= +Received: by 10.36.220.67 with SMTP id s67mr3790563nzg; + Mon, 18 Jul 2005 00:51:41 -0700 (PDT) +Received: by 10.36.22.20 with HTTP; Mon, 18 Jul 2005 00:51:41 -0700 (PDT) +Message-ID: <758d5e7f050718005164cbe9a4@mail.gmail.com> +Date: Mon, 18 Jul 2005 09:51:41 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: Bruno Wolff III , + Dan Harris , pgsql-performance@postgresql.org +Subject: Re: slow joining very large table to smaller ones +In-Reply-To: <20050715164458.GA26178@wolff.to> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <46AF8F35-B735-4DFA-BA0A-AC82B5DA3CCE@drivefaster.net> + <42D687E5.7080202@arbash-meinel.com> + + <20050715164458.GA26178@wolff.to> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.614 tagged_above=0 required=5 tests=AWL, + FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/255 +X-Sequence-Number: 13496 + +On 7/15/05, Bruno Wolff III wrote: +> On Thu, Jul 14, 2005 at 16:29:58 -0600, +> Dan Harris wrote: +> > +> > Ok, I tried this one. My ssh keeps getting cut off by a router +> > somewhere between me and the server due to inactivity timeouts, so +> > all I know is that both the select and explain analyze are taking +> > over an hour to run. Here's the explain select for that one, since +> > that's the best I can get. +>=20 +> Are you using NAT at home? That's probably where the issue is. If you +> have control of that box you can probably increase the timeout to a +> couple of hours. + +Some versions of ssh have such a configuration option (in .ssh/config): + +Host * + ServerAliveInterval 600 + +...it means that ssh will send a "ping" packet to a sshd every 10 minutes +of inactivity. This way NAT will see activity and won't kill the session. +I'm using OpenSSH_4.1p1 for this... + +Oh, and it doesn't have anything to do with TCP keep alive, which is +rather for finding dead connections than keeping connections alive. ;) + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Mon Jul 18 10:23:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A6E852C8E + for ; + Mon, 18 Jul 2005 10:23:17 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01371-04 + for ; + Mon, 18 Jul 2005 13:23:12 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0950A52C7F + for ; + Mon, 18 Jul 2005 10:23:11 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6IDNBGE002467; + Mon, 18 Jul 2005 09:23:11 -0400 (EDT) +To: Robert Creager +Cc: PGPerformance , + Andy Hewitt +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +In-reply-to: <20050717235630.26a7c979@thunder.logicalchaos.org> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <24520.1121659853@sss.pgh.pa.us> + <20050717235630.26a7c979@thunder.logicalchaos.org> +Comments: In-reply-to Robert Creager + message dated "Sun, 17 Jul 2005 23:56:30 -0600" +Date: Mon, 18 Jul 2005 09:23:11 -0400 +Message-ID: <2466.1121692991@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/256 +X-Sequence-Number: 13497 + +Robert Creager writes: +> Tom Lane confessed: +>> The context swap problem was no worse in 8.0 than in prior versions, +>> so that hardly seems like a good explanation. Have you tried reverting +>> to the cron-based vacuuming method you used in 7.4? + +> I've "vacuum_cost_delay = 10" in the conf file for 803. + +Hmm, did you read this thread? +http://archives.postgresql.org/pgsql-performance/2005-07/msg00088.php + +It's still far from clear what's going on there, but it might be +interesting to see if turning off the vacuum delay changes your results +with 8.0. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 18 10:41:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6EA7A52A3C + for ; + Mon, 18 Jul 2005 10:41:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03547-07 + for ; + Mon, 18 Jul 2005 13:41:05 +0000 (GMT) +Received: from rambo.iniquinet.com (rambo.iniquinet.com [69.39.89.10]) + by svr1.postgresql.org (Postfix) with ESMTP id DA43D52CA9 + for ; + Mon, 18 Jul 2005 10:41:03 -0300 (ADT) +Received: (qmail 32208 invoked by uid 1010); 18 Jul 2005 09:41:06 -0400 +Received: from Robert_Creager@LogicalChaos.org by rambo.iniquinet.com by uid + 1002 with qmail-scanner-1.20 (clamscan: 0.70. spamassassin: 3.0.3. + Clear:RC:0(63.147.78.131):SA:0(?/?):. + Processed in 4.074218 secs); 18 Jul 2005 13:41:06 -0000 +Received: from unknown (HELO thunder.logicalchaos.org) + (perl?test@logicalchaos.org@63.147.78.131) + by rambo.iniquinet.com with AES256-SHA encrypted SMTP; + 18 Jul 2005 09:41:02 -0400 +Received: from logicalchaos.org (thunder.logicalchaos.org [192.168.0.250]) + by thunder.logicalchaos.org (Postfix) with ESMTP id B5F0EB32C5; + Mon, 18 Jul 2005 07:41:00 -0600 (MDT) +Date: Mon, 18 Jul 2005 07:41:00 -0600 +From: Robert Creager +To: Tom Lane +Cc: PGPerformance , + Andy Hewitt +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +Message-ID: <20050718074100.3159e825@thunder.logicalchaos.org> +In-Reply-To: <24520.1121659853@sss.pgh.pa.us> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <24520.1121659853@sss.pgh.pa.us> +Organization: Starlight Vision, LLC. +X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i586-mandrake-linux-gnu) +Mime-Version: 1.0 +Content-Type: multipart/signed; + boundary=Signature_Mon__18_Jul_2005_07_41_00_-0600_qIUf4mwaPMLUfx2w; + protocol="application/pgp-signature"; micalg=pgp-sha1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/257 +X-Sequence-Number: 13498 + +--Signature_Mon__18_Jul_2005_07_41_00_-0600_qIUf4mwaPMLUfx2w +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: quoted-printable + +When grilled further on (Mon, 18 Jul 2005 00:10:53 -0400), +Tom Lane confessed: + +> The context swap problem was no worse in 8.0 than in prior versions, +> so that hardly seems like a good explanation. Have you tried reverting +> to the cron-based vacuuming method you used in 7.4? +>=20 + +Ran 7 hours on 741 with VACUUM ANALYZE every 5 minutes. The largest CS I s= +aw +was 40k, with an average of 500 (via script which monitors vmstat output). + +I've done a VACUUM FULL ANALYZE on 803 and have switched the cron based VAC= +UUM +ANALYZE to 803 also. The tests are now running again. + +> Hmm, did you read this thread? +> http://archives.postgresql.org/pgsql-performance/2005-07/msg00088.php + +I just glanced at it. Once I've reproduced (or not) the problem on 803 wit= +h the +VACUUM FULL, I'll turn off the vacuum delay. + +Cheers, +Rob + +--=20 + 07:10:06 up 4 days, 10:45, 6 users, load average: 0.28, 0.40, 0.29 +Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + +--Signature_Mon__18_Jul_2005_07_41_00_-0600_qIUf4mwaPMLUfx2w +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iEYEARECAAYFAkLbsWwACgkQLQ/DKuwDYzktbQCfZ39U38nwHZ/2Kme20kghS5fe +9F8AnigtFAQ1h9A/WQn2V53aWivWiMNR +=MFbd +-----END PGP SIGNATURE----- + +--Signature_Mon__18_Jul_2005_07_41_00_-0600_qIUf4mwaPMLUfx2w-- + +From pgsql-performance-owner@postgresql.org Mon Jul 18 10:47:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 50E2452CA9 + for ; + Mon, 18 Jul 2005 10:47:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07276-04 + for ; + Mon, 18 Jul 2005 13:47:45 +0000 (GMT) +Received: from rambo.iniquinet.com (rambo.iniquinet.com [69.39.89.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 75BEE52C92 + for ; + Mon, 18 Jul 2005 10:47:44 -0300 (ADT) +Received: (qmail 2307 invoked by uid 1010); 18 Jul 2005 09:47:48 -0400 +Received: from Robert_Creager@LogicalChaos.org by rambo.iniquinet.com by uid + 1002 with qmail-scanner-1.20 (clamscan: 0.70. spamassassin: 3.0.3. + Clear:RC:0(63.147.78.131):SA:0(?/?):. + Processed in 1.930243 secs); 18 Jul 2005 13:47:48 -0000 +Received: from unknown (HELO thunder.logicalchaos.org) + (perl?test@logicalchaos.org@63.147.78.131) + by rambo.iniquinet.com with AES256-SHA encrypted SMTP; + 18 Jul 2005 09:47:46 -0400 +Received: from logicalchaos.org (thunder.logicalchaos.org [192.168.0.250]) + by thunder.logicalchaos.org (Postfix) with ESMTP id 3FD5EB3281; + Mon, 18 Jul 2005 07:47:45 -0600 (MDT) +Date: Mon, 18 Jul 2005 07:47:44 -0600 +From: Robert Creager +To: Tom Lane +Cc: Robert Creager , + PGPerformance , + Andy Hewitt +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +Message-ID: <20050718074744.03afadc3@thunder.logicalchaos.org> +In-Reply-To: <2466.1121692991@sss.pgh.pa.us> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <24520.1121659853@sss.pgh.pa.us> + <20050717235630.26a7c979@thunder.logicalchaos.org> + <2466.1121692991@sss.pgh.pa.us> +Organization: Starlight Vision, LLC. +X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i586-mandrake-linux-gnu) +Mime-Version: 1.0 +Content-Type: multipart/signed; + boundary=Signature_Mon__18_Jul_2005_07_47_44_-0600_XnmEX04qaPa4tVZp; + protocol="application/pgp-signature"; micalg=pgp-sha1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/258 +X-Sequence-Number: 13499 + +--Signature_Mon__18_Jul_2005_07_47_44_-0600_XnmEX04qaPa4tVZp +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: quoted-printable + +When grilled further on (Mon, 18 Jul 2005 09:23:11 -0400), +Tom Lane confessed: + +> It's still far from clear what's going on there, but it might be +> interesting to see if turning off the vacuum delay changes your results +> with 8.0. +>=20 + +Can that be affected by hupping the server, or do I need a restart? + +Thanks, +Rob + +--=20 + 07:46:53 up 4 days, 11:21, 6 users, load average: 0.77, 0.43, 0.27 +Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + +--Signature_Mon__18_Jul_2005_07_47_44_-0600_XnmEX04qaPa4tVZp +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iEYEARECAAYFAkLbswAACgkQLQ/DKuwDYznL2gCfThEJTfYMCMQIovWPcVxUbHSe +PQ8An2/1naVwenNBHzQSc2JuyT/HkaK8 +=Cs86 +-----END PGP SIGNATURE----- + +--Signature_Mon__18_Jul_2005_07_47_44_-0600_XnmEX04qaPa4tVZp-- + +From pgsql-performance-owner@postgresql.org Mon Jul 18 11:03:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AA47B52A3C + for ; + Mon, 18 Jul 2005 11:03:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 32594-01 + for ; + Mon, 18 Jul 2005 14:03:53 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E660852CAB + for ; + Mon, 18 Jul 2005 11:03:52 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6IE3sZt002899; + Mon, 18 Jul 2005 10:03:54 -0400 (EDT) +To: Robert Creager +Cc: PGPerformance , + Andy Hewitt +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +In-reply-to: <20050718074744.03afadc3@thunder.logicalchaos.org> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <24520.1121659853@sss.pgh.pa.us> + <20050717235630.26a7c979@thunder.logicalchaos.org> + <2466.1121692991@sss.pgh.pa.us> + <20050718074744.03afadc3@thunder.logicalchaos.org> +Comments: In-reply-to Robert Creager + message dated "Mon, 18 Jul 2005 07:47:44 -0600" +Date: Mon, 18 Jul 2005 10:03:54 -0400 +Message-ID: <2898.1121695434@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/259 +X-Sequence-Number: 13500 + +Robert Creager writes: +> Tom Lane confessed: +>> It's still far from clear what's going on there, but it might be +>> interesting to see if turning off the vacuum delay changes your results +>> with 8.0. + +> Can that be affected by hupping the server, or do I need a restart? + +sighup should be fine. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 18 11:31:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D064B52CB4 + for ; + Mon, 18 Jul 2005 11:31:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 43273-05 + for ; + Mon, 18 Jul 2005 14:31:47 +0000 (GMT) +Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) + by svr1.postgresql.org (Postfix) with ESMTP id 3D7FC52CB0 + for ; + Mon, 18 Jul 2005 11:31:46 -0300 (ADT) +Received: from ool-4350c7ad.dyn.optonline.net ([67.80.199.173] + helo=[192.168.0.66]) + by outbound.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) + (Exim 4.51) id 1DuWer-000Lcw-3O; Mon, 18 Jul 2005 10:31:49 -0400 +X-Mail-Handler: MailHop Outbound by DynDNS.org +X-Originating-IP: 67.80.199.173 +X-Report-Abuse-To: abuse@dyndns.org (see + http://www.mailhop.org/outbound/abuse.html for abuse reporting + information) +X-MHO-User: zeut +Message-ID: <42DBBD4A.6030209@zeut.net> +Date: Mon, 18 Jul 2005 10:31:38 -0400 +From: "Matthew T. O'Connor" +Organization: Terrie O'Connor Realtors +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: Robert Creager , + PGPerformance , + Andy Hewitt +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <24520.1121659853@sss.pgh.pa.us> + <20050717235630.26a7c979@thunder.logicalchaos.org> + <2466.1121692991@sss.pgh.pa.us> +In-Reply-To: <2466.1121692991@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/260 +X-Sequence-Number: 13501 + +Tom Lane wrote: + +>Robert Creager writes: +> +> +>>I've "vacuum_cost_delay = 10" in the conf file for 803. +>> +>> +> +>Hmm, did you read this thread? +>http://archives.postgresql.org/pgsql-performance/2005-07/msg00088.php +> +>It's still far from clear what's going on there, but it might be +>interesting to see if turning off the vacuum delay changes your results +>with 8.0. +> + +With the contrib autovacuum code if you don't specify vacuum delay +settings from the command line, then autovacuum doesn't touch them. +Therefore (if you aren't specifying them from the command line), on 803, +the vacuum delay settings should be the same for a cron issued vacuum +and an autovacuum issued vacuum. So if the vacuum delay settings are +the problem, then it should show up either way. + + +Matt + + +From pgsql-performance-owner@postgresql.org Mon Jul 18 11:53:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 779A152A3C + for ; + Mon, 18 Jul 2005 11:53:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66483-04 + for ; + Mon, 18 Jul 2005 14:53:00 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 788F752CB2 + for ; + Mon, 18 Jul 2005 11:53:00 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6IEr43g003284; + Mon, 18 Jul 2005 10:53:04 -0400 (EDT) +To: "Matthew T. O'Connor" +Cc: Robert Creager , + PGPerformance , + Andy Hewitt +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - +In-reply-to: <42DBBD4A.6030209@zeut.net> +References: <20050717213416.59dcb52e@thunder.logicalchaos.org> + <24520.1121659853@sss.pgh.pa.us> + <20050717235630.26a7c979@thunder.logicalchaos.org> + <2466.1121692991@sss.pgh.pa.us> <42DBBD4A.6030209@zeut.net> +Comments: In-reply-to "Matthew T. O'Connor" + message dated "Mon, 18 Jul 2005 10:31:38 -0400" +Date: Mon, 18 Jul 2005 10:53:04 -0400 +Message-ID: <3283.1121698384@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/261 +X-Sequence-Number: 13502 + +"Matthew T. O'Connor" writes: +> Therefore (if you aren't specifying them from the command line), on 803, +> the vacuum delay settings should be the same for a cron issued vacuum +> and an autovacuum issued vacuum. So if the vacuum delay settings are +> the problem, then it should show up either way. + +... as indeed it does according to Robert's recent reports. Still +awaiting the definitive test, but I'm starting to think this is another +case of the strange behavior Ian Westmacott exhibited. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 18 14:50:14 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F1C22529B2 + for ; + Mon, 18 Jul 2005 14:50:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12107-09 + for ; + Mon, 18 Jul 2005 17:50:04 +0000 (GMT) +Received: from prospect.stortek.com (prospect.stortek.com [129.80.22.147]) + by svr1.postgresql.org (Postfix) with ESMTP id ADE1252896 + for ; + Mon, 18 Jul 2005 14:50:02 -0300 (ADT) +Received: from prospect.stortek.com (localhost [127.0.0.1]) + by prospect.stortek.com (8.12.10/8.12.0) with ESMTP id j6IHo1Wl013926 + for ; + Mon, 18 Jul 2005 11:50:02 -0600 (MDT) +Received: from unix.stortek.com (burma.stortek.com [129.80.16.110]) + by prospect.stortek.com (8.12.10/8.12.0) with ESMTP id j6IHo1bc013921; + Mon, 18 Jul 2005 11:50:01 -0600 (MDT) +Received: from C118181.stortek.com (c118181.stortek.com [129.80.81.172]) + by unix.stortek.com (8.12.10/8.12.0) with ESMTP id j6IHo0vn027391; + Mon, 18 Jul 2005 11:50:00 -0600 (MDT) +Date: Mon, 18 Jul 2005 11:49:52 -0600 +From: Robert Creager +To: tgl@sss.pgh.pa.us, matthew@zeut.net, + pgsql-performance@postgresql.org +Cc: Andy Hewitt III +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS issue? +Message-ID: <20050718114952.00004ac5@C118181.stortek.com> +Organization: StorageTek +X-Mailer: Sylpheed-Claws 1.0.4.1 Win32 (GTK+ 1.3.0; Win32) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/262 +X-Sequence-Number: 13503 + + +In regards to +http://archives.postgresql.org/pgsql-performance/2005-07/msg00261.php + +Tom Says: +> ... as indeed it does according to Robert's recent reports. Still +> awaiting the definitive test, but I'm starting to think this is another +> case of the strange behavior Ian Westmacott exhibited. + +Ok. This morning at around 7:30am I started tests against a freshly VACUUM FULL +ANALYZE 803 database with the vacuum delay on and cron running vacuum analyze +every 5 minutes. + +Around 8:15 I was starting to receive hits of a few seconds of high CS hits, +higher than the previous 7 hour run on 741. I changed the vacuum delay to 0 and +HUP'ed the server (how can I see the value vacuum_cost_delay run time?). By +10:30, I had vacuum jobs backed up since 9:20 and the queries were over 75 +seconds. + +I'm currently running on 741 as I need to get work done today ;-) I'll restart +the 803 db, vacuum full analyze again and next opportunity (maybe tonight), +start runs again with cron vacuum and a vacuum_cost_delay of 0, unless I should +try something else? + +Cheers, +Rob + +-- + +Robert Creager +Advisory Software Engineer +Phone 303.673.2365 +Pager 888.912.4458 +Fax 303.661.5379 +StorageTek + +From pgsql-performance-owner@postgresql.org Mon Jul 18 14:52:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8236952B4C + for ; + Mon, 18 Jul 2005 14:52:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 15692-02 + for ; + Mon, 18 Jul 2005 17:52:55 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6F7A952B24 + for ; + Mon, 18 Jul 2005 14:52:54 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6IHqrKY015473; + Mon, 18 Jul 2005 13:52:53 -0400 (EDT) +To: Robert Creager +Cc: matthew@zeut.net, pgsql-performance@postgresql.org, + Andy Hewitt III +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS issue? +In-reply-to: <20050718114952.00004ac5@C118181.stortek.com> +References: <20050718114952.00004ac5@C118181.stortek.com> +Comments: In-reply-to Robert Creager + message dated "Mon, 18 Jul 2005 11:49:52 -0600" +Date: Mon, 18 Jul 2005 13:52:53 -0400 +Message-ID: <15472.1121709173@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/263 +X-Sequence-Number: 13504 + +Robert Creager writes: +> Around 8:15 I was starting to receive hits of a few seconds of high CS hits, +> higher than the previous 7 hour run on 741. I changed the vacuum delay to 0 and +> HUP'ed the server (how can I see the value vacuum_cost_delay run +> time?). + +Start a fresh psql session and "SHOW vacuum_cost_delay" to verify what +the active setting is. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 18 14:57:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5748D529B2 + for ; + Mon, 18 Jul 2005 14:57:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14526-08 + for ; + Mon, 18 Jul 2005 17:57:37 +0000 (GMT) +Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.91]) + by svr1.postgresql.org (Postfix) with ESMTP id 1F10E52B11 + for ; + Mon, 18 Jul 2005 14:57:36 -0300 (ADT) +Received: from Courts-MTA by gwmta.wicourts.gov + with Novell_GroupWise; Mon, 18 Jul 2005 12:57:35 -0500 +Message-Id: +X-Mailer: Novell GroupWise Internet Agent 6.5.2 +Date: Mon, 18 Jul 2005 12:57:31 -0500 +From: "Kevin Grittner" +To: , +Subject: Re: join and query planner +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, hits=0.019 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/264 +X-Sequence-Number: 13505 + +Just out of curiosity, does it do any better with the following? + + SELECT ... + FROM a + JOIN b ON (a.key = b.key) + LEFT JOIN c ON (c.key = a.key) + LEFT JOIN d ON (d.key=a.key) + WHERE (b.column <= 100) + + +>>> "Dario Pudlo" 07/06/05 4:54 PM >>> +(first at all, sorry for my english) +Hi. + - Does "left join" restrict the order in which the planner must join +tables? I've read about join, but i'm not sure about left join... + - If so: Can I avoid this behavior? I mean, make the planner resolve +the +query, using statistics (uniqueness, data distribution) rather than join +order. + + My query looks like: + SELECT ... + FROM a, b, + LEFT JOIN c ON (c.key = a.key) + LEFT JOIN d on (d.key=a.key) + WHERE (a.key = b.key) AND (b.column <= 100) + + b.column has a lot better selectivity, but planner insist on +resolve +first c.key = a.key. + + Of course, I could rewrite something like: + SELECT ... + FROM + (SELECT ... + FROM a,b + LEFT JOIN d on (d.key=a.key) + WHERE (b.column <= 100) + ) + as aa + LEFT JOIN c ON (c.key = aa.key) + + but this is query is constructed by an application with a +"multicolumn" +filter. It's dynamic. + It means that a user could choose to look for "c.column = 1000". +And +also, combinations of filters. + + So, I need the planner to choose the best plan... + +I've already change statistics, I clustered tables with cluster, ran +vacuum +analyze, changed work_mem, shared_buffers... + +Greetings. TIA. + + +---------------------------(end of broadcast)--------------------------- +TIP 2: Don't 'kill -9' the postmaster + + +From pgsql-performance-owner@postgresql.org Mon Jul 18 15:21:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CB26052BD2 + for ; + Mon, 18 Jul 2005 15:21:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23253-01 + for ; + Mon, 18 Jul 2005 18:21:14 +0000 (GMT) +Received: from sherman.stortek.com (sherman.stortek.com [129.80.22.146]) + by svr1.postgresql.org (Postfix) with ESMTP id DE9A452C26 + for ; + Mon, 18 Jul 2005 15:21:12 -0300 (ADT) +Received: from sherman.stortek.com (localhost [127.0.0.1]) + by sherman.stortek.com (8.12.10/8.12.0) with ESMTP id j6IILDD4000405 + for ; + Mon, 18 Jul 2005 12:21:13 -0600 (MDT) +Received: from unix.stortek.com (burma.stortek.com [129.80.16.110]) + by sherman.stortek.com (8.12.10/8.12.0) with ESMTP id j6IILCDC000402; + Mon, 18 Jul 2005 12:21:12 -0600 (MDT) +Received: from C118181.stortek.com (c118181.stortek.com [129.80.81.172]) + by unix.stortek.com (8.12.10/8.12.0) with ESMTP id j6IILBvn028899; + Mon, 18 Jul 2005 12:21:11 -0600 (MDT) +Date: Mon, 18 Jul 2005 12:21:03 -0600 +From: Robert Creager +To: Tom Lane +Cc: matthew@zeut.net, pgsql-performance@postgresql.org, + Andy Hewitt III +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS issue? +Message-ID: <20050718122103.0000064a@C118181.stortek.com> +In-Reply-To: <15472.1121709173@sss.pgh.pa.us> +References: <20050718114952.00004ac5@C118181.stortek.com> + <15472.1121709173@sss.pgh.pa.us> +Organization: StorageTek +X-Mailer: Sylpheed-Claws 1.0.4.1 Win32 (GTK+ 1.3.0; Win32) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/265 +X-Sequence-Number: 13506 + +On Mon, 18 Jul 2005 13:52:53 -0400 +Tom Lane wrote: + +> Start a fresh psql session and "SHOW vacuum_cost_delay" to verify what +> the active setting is. + +Thanks. It does show 0 for 803 in a session that was up since I thought I had +HUPed the server with the new value. + +This is leading me to believe that 803 doesn't do very well with VACUUM ANALYZE +running often, at least in my particular application... I will provide a more +definitive statement to that affect, hopefully tonight. + +Cheers, +Rob + +From pgsql-performance-owner@postgresql.org Mon Jul 18 15:32:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 66A97529A9 + for ; + Mon, 18 Jul 2005 15:32:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25086-01 + for ; + Mon, 18 Jul 2005 18:32:17 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id 9C59F52996 + for ; + Mon, 18 Jul 2005 15:32:15 -0300 (ADT) +Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) + by yertle.kcilink.com (Postfix) with ESMTP id EDD4DB824 + for ; + Mon, 18 Jul 2005 14:32:14 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v733) +In-Reply-To: <59d991c4050717100874c08a86@mail.gmail.com> +References: <59d991c4050717100874c08a86@mail.gmail.com> +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-2--477069979; + protocol="application/pkcs7-signature" +Message-Id: +From: Vivek Khera +Subject: Re: Impact of checkpoint_segments under continual load conditions +Date: Mon, 18 Jul 2005 14:32:14 -0400 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.733) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.022 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/266 +X-Sequence-Number: 13507 + + +--Apple-Mail-2--477069979 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + delsp=yes; + format=flowed + + +On Jul 17, 2005, at 1:08 PM, Christopher Petrilli wrote: + +> Normally, checkpoint_segments can help absorb some of that, but my +> experience is that if I crank the number up, it simply delays the +> impact, and when it occurs, it takes a VERY long time (minutes) to +> clear. + +There comes a point where your only recourse is to throw hardware at +the problem. I would suspect that getting faster disks and splitting +the checkpoint log to its own RAID partition would help you here. +Adding more RAM while you're at it always does wonders for me :-) + +Vivek Khera, Ph.D. ++1-301-869-4449 x806 + + + +--Apple-Mail-2--477069979 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w +ggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0 +ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcx +KDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0 +ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxA +dGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTlaMGIxCzAJBgNVBAYTAlpB +MSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUg +UGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBg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SkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt +YWlsIElzc3VpbmcgQ0ECAw5qHzB6BgsqhkiG9w0BCRACCzFroGkwYjELMAkGA1UEBhMCWkExJTAj +BgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJz +b25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMOah8wDQYJKoZIhvcNAQEBBQAEggEALNRgQiUwFLxt +ZHWxekLhjdzdHk1TLMEeKD889yVGFeCMN1dV8jwFg9DLmo0iPDlD/jZo/r/tjXSwEzXFbEjfBNPI +3BHt6wrqO7w6JMT5I41ZSsfWH0jfrO6Vo8zl9rDRvioV3YD6gzjsyH5Yf+047vrSaEKMsmphAPEc +SrgDMYHy04L0ehf0dXQYs/Pf0WvqAkmVATocYCkeRtZoWAgbx2n5l6Ybwk1VsaGSQJZJW0JkNQv8 +pHqx+UZGfJuISQCeERTy22Tq2TSnZzDJ2xhiJC1espe0UbTDR/+zcJ51ZjO5bJI8wqiD60q9X5K5 +WAIMK405IP/H9TCZaloRFVTOeQAAAAAAAA== + +--Apple-Mail-2--477069979-- + +From pgsql-performance-owner@postgresql.org Mon Jul 18 15:46:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A852C52BD1 + for ; + Mon, 18 Jul 2005 15:46:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23015-07 + for ; + Mon, 18 Jul 2005 18:46:24 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.203]) + by svr1.postgresql.org (Postfix) with ESMTP id 0955152996 + for ; + Mon, 18 Jul 2005 15:46:23 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i35so1052059wra + for ; + Mon, 18 Jul 2005 11:46:24 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=fzdyxgwM0EHwlpwkiVXl4cVEn56OlccDYj6X+HmyIRR4ok1+k3IEIf1Z/zrq7qLN5vX1jkLAToOdc8qFKZAgduwmTHpZx6+WMJVvYZ1By4a1WAXT0OwexG6ZWrDqWtyyevp9yEXodPGFFUW8dq7dwCotazZm+P3MnyQhxUyS36E= +Received: by 10.54.37.47 with SMTP id k47mr460663wrk; + Mon, 18 Jul 2005 11:45:37 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Mon, 18 Jul 2005 11:45:35 -0700 (PDT) +Message-ID: <59d991c405071811457ccdd3f1@mail.gmail.com> +Date: Mon, 18 Jul 2005 14:45:35 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Vivek Khera +Subject: Re: Impact of checkpoint_segments under continual load conditions +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: <59d991c4050717100874c08a86@mail.gmail.com> + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.126 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/267 +X-Sequence-Number: 13508 + +On 7/18/05, Vivek Khera wrote: +>=20 +> On Jul 17, 2005, at 1:08 PM, Christopher Petrilli wrote: +>=20 +> > Normally, checkpoint_segments can help absorb some of that, but my +> > experience is that if I crank the number up, it simply delays the +> > impact, and when it occurs, it takes a VERY long time (minutes) to +> > clear. +>=20 +> There comes a point where your only recourse is to throw hardware at +> the problem. I would suspect that getting faster disks and splitting +> the checkpoint log to its own RAID partition would help you here. +> Adding more RAM while you're at it always does wonders for me :-) + +My concern is less with absolute performance, than with the nosedive +it goes into. I published some of my earlier findings and comparisons +on my blog, but there's a graph here: + +http://blog.amber.org/diagrams/comparison_mysql_pgsql.png + +Notice the VERY steep drop off. I'm still trying to get rid of it, +but honestly, am not smart enough to know where it's originating. I +have no desire to ever use MySQL, but it is a reference point, and +since I don't particularly need transactional integrity, a valid +comparison. + +Chris +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Mon Jul 18 16:24:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 281C852CDC + for ; + Mon, 18 Jul 2005 16:24:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 33161-08 + for ; + Mon, 18 Jul 2005 19:24:24 +0000 (GMT) +Received: from netbox.unitech.com.ar (unknown [200.32.92.34]) + by svr1.postgresql.org (Postfix) with ESMTP id C37DD52CD7 + for ; + Mon, 18 Jul 2005 16:24:21 -0300 (ADT) +Received: from dariop (dariop.unitech.com.ar [192.168.1.237]) + by netbox.unitech.com.ar (8.11.6/8.11.6) with ESMTP id j6IKOhE17938 + for ; Mon, 18 Jul 2005 16:24:43 -0400 +Received: from 127.0.0.1 (AVG SMTP 7.0.323 [267.9.0]); + Mon, 18 Jul 2005 16:24:19 -0300 +From: "Dario" +To: +Subject: Re: join and query planner +Date: Mon, 18 Jul 2005 16:24:19 -0300 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +In-Reply-To: +X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.104 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/268 +X-Sequence-Number: 13509 + +Hi. + +> Just out of curiosity, does it do any better with the following? +> +> SELECT ... + +Yes, it does. + +But my query could also be + SELECT ... + FROM a + JOIN b ON (a.key = b.key) + LEFT JOIN c ON (c.key = a.key) + LEFT JOIN d ON (d.key=a.key) +/*new*/ , e + WHERE (b.column <= 100) +/*new*/ and (e.key = a.key) and (e.field = 'filter') + +because it's constructed by an application. I needed to know if, somehow, +someway, I can "unforce" join order. +The only way to solve it so far is changing application. It must build +something like + + SELECT ... + FROM b + JOIN (a JOIN e ON (e.key = a.key)) ON (a.key = b.key) + LEFT JOIN c ON (c.key = a.key) + LEFT JOIN d ON (d.key=a.key) + WHERE (b.column <= 100) and (e.field = 'filter') + +Supossed that e.field has (should have) better selectivity. But now this +problem belongs to programmer's group :-) + +The query, in fact, has more tables to join. I wonder if lowering geqo +threshold could do the work... + +Thank you. Greetings. Long life, little spam and prosperity! + + +-----Mensaje original----- +De: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org]En nombre de Kevin +Grittner +Enviado el: lunes, 18 de julio de 2005 14:58 +Para: pgsql-performance@postgresql.org; dariop@unitech.com.ar +Asunto: Re: [PERFORM] join and query planner + + +Just out of curiosity, does it do any better with the following? + + SELECT ... + FROM a + JOIN b ON (a.key = b.key) + LEFT JOIN c ON (c.key = a.key) + LEFT JOIN d ON (d.key=a.key) + WHERE (b.column <= 100) + + +>>> snipp + + +From pgsql-performance-owner@postgresql.org Mon Jul 18 16:29:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D2FA952CC6 + for ; + Mon, 18 Jul 2005 16:29:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36518-02 + for ; + Mon, 18 Jul 2005 19:29:23 +0000 (GMT) +Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) + by svr1.postgresql.org (Postfix) with ESMTP id 5C33652CBB + for ; + Mon, 18 Jul 2005 16:29:21 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by apate.telenet-ops.be (Postfix) with SMTP id 8831A381ED + for ; + Mon, 18 Jul 2005 21:29:21 +0200 (CEST) +Received: from [10.0.1.2] (d5152B1F3.access.telenet.be [81.82.177.243]) + by apate.telenet-ops.be (Postfix) with ESMTP id 02ADD38123 + for ; + Mon, 18 Jul 2005 21:29:21 +0200 (CEST) +Mime-Version: 1.0 (Apple Message framework v622) +To: pgsql-performance@postgresql.org +Message-Id: +Content-Type: multipart/mixed; boundary=Apple-Mail-57--473644005 +From: Yves Vindevogel +Subject: Insert performance (OT?) +Date: Mon, 18 Jul 2005 21:29:20 +0200 +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/269 +X-Sequence-Number: 13510 + + +--Apple-Mail-57--473644005 +Content-Type: multipart/alternative; + boundary=Apple-Mail-58--473644004 + + +--Apple-Mail-58--473644004 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/plain; + charset=ISO-8859-1; + format=flowed + +Hi, + +Suppose I have a table with 4 fields (f1, f2, f3, f4) +I define 2 unique indexes u1 (f1, f2, f3) and u2 (f1, f2, f4) + +I have 3 records +A, B, C, D (this will be inserted) +A, B, C, E (this will pass u2, but not u1, thus not inserted) +A, B, F, D (this will pass u1, but not u2, thus not inserted) + +Now, for performance ... + +I have tables like this with 500.000 records where there's a new upload=20= + +of approx. 20.000 records. +It is only now that we say index u2 to be necessary. So, until now, I=20= + +did something like insert into ... select f1, f2, f2, max(f4) group by=20= + +f1, f2, f3 +That is ok ... and also logically ok because of the data definition + +I cannot do this with 2 group by's. I tried this on paper and I'm not=20= + +succeeding. + +So, I must use a function that will check against u1 and u2, and then=20 +insert if it is ok. +I know that such a function is way slower that my insert query. + +So, my question ... +How can I keep the same performance, but also with the new index in=20 +mind ??? + + +Met vriendelijke groeten, +Bien =E0 vous, +Kind regards, + +Yves Vindevogel +Implements + + +--Apple-Mail-58--473644004 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/enriched; + charset=ISO-8859-1 + +Hi, + + +Suppose I have a table with 4 fields (f1, f2, f3, f4) + +I define 2 unique indexes u1 (f1, f2, f3) and u2 (f1, f2, f4) + + +I have 3 records + +A, B, C, D (this will be inserted) + +A, B, C, E (this will pass u2, but not u1, thus not inserted) + +A, B, F, D (this will pass u1, but not u2, thus not inserted) + + +Now, for performance ... + + +I have tables like this with 500.000 records where there's a new +upload of approx. 20.000 records. + +It is only now that we say index u2 to be necessary. So, until now, I +did something like insert into ... select f1, f2, f2, max(f4) group by +f1, f2, f3 + +That is ok ... and also logically ok because of the data definition + + +I cannot do this with 2 group by's. I tried this on paper and I'm not +succeeding. + + +So, I must use a function that will check against u1 and u2, and then +insert if it is ok. + +I know that such a function is way slower that my insert query. + + +So, my question ... + +How can I keep the same performance, but also with the new index in +mind ??? + + + +Met vriendelijke groeten, + +Bien =E0 vous, + +Kind regards, + + +Yves Vindevogel + +Implements + + + += + +--Apple-Mail-58--473644004-- + +--Apple-Mail-57--473644005 +Content-Transfer-Encoding: base64 +Content-Type: image/tiff; + x-unix-mode=0666; + name="Pasted Graphic 2.tiff" +Content-Disposition: inline; + filename="Pasted Graphic 2.tiff" + +TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP +8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho +9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ +RNtOl4Rhftt/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AABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb +AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA +CAAK/IAAACcQAAr8gAAAJxA= + +--Apple-Mail-57--473644005 +Content-Type: multipart/alternative; + boundary=Apple-Mail-59--473644003 + + +--Apple-Mail-59--473644003 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + format=flowed + + + +Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 + +Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 + +Web: http://www.implements.be + +First they ignore you. Then they laugh at you. Then they fight you. +Then you win. +Mahatma Ghandi. +--Apple-Mail-59--473644003 +Content-Transfer-Encoding: 7bit +Content-Type: text/enriched; + charset=US-ASCII + + + + +Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 + + +Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 + + +Web: http://www.implements.be + + + +First they ignore you. Then they laugh at you. Then they fight you. +Then you win. + +Mahatma Ghandi. +--Apple-Mail-59--473644003-- + +--Apple-Mail-57--473644005-- + + +From pgsql-performance-owner@postgresql.org Mon Jul 18 16:32:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 502DD529C0 + for ; + Mon, 18 Jul 2005 16:32:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36311-06 + for ; + Mon, 18 Jul 2005 19:32:39 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4636452AC0 + for ; + Mon, 18 Jul 2005 16:32:38 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6IJWaw2016395; + Mon, 18 Jul 2005 15:32:36 -0400 (EDT) +To: Christopher Petrilli +Cc: Vivek Khera , pgsql-performance@postgresql.org +Subject: Re: Impact of checkpoint_segments under continual load conditions +In-reply-to: <59d991c405071811457ccdd3f1@mail.gmail.com> +References: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Mon, 18 Jul 2005 14:45:35 -0400" +Date: Mon, 18 Jul 2005 15:32:36 -0400 +Message-ID: <16394.1121715156@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/270 +X-Sequence-Number: 13511 + +Christopher Petrilli writes: +> http://blog.amber.org/diagrams/comparison_mysql_pgsql.png + +> Notice the VERY steep drop off. + +Hmm. Whatever that is, it's not checkpoint's fault. I would interpret +the regular upticks in the Postgres times (every several hundred +iterations) as being the effects of checkpoints. You could probably +smooth out those peaks some with appropriate hacking on bgwriter +parameters, but that's not the issue at hand (is it?). + +I have no idea at all what's causing the sudden falloff in performance +after about 10000 iterations. COPY per se ought to be about a +constant-time operation, since APPEND is (or should be) constant-time. +What indexes, foreign keys, etc do you have on this table? What else +was going on at the time? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 18 16:36:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8336B52AC3 + for ; + Mon, 18 Jul 2005 16:36:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36543-06 + for ; + Mon, 18 Jul 2005 19:36:19 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) + by svr1.postgresql.org (Postfix) with ESMTP id 6D9B7529C0 + for ; + Mon, 18 Jul 2005 16:36:18 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i34so1058753wra + for ; + Mon, 18 Jul 2005 12:36:20 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=iyjsSuCvUJvaUNJwO+eKhaBdUg3zPl7pUCHYZuln7EatkQvJUaxOMDMxlaQ/NTC/oRermpE4rsfbSYVVMUpykmHGGC0TLeygoEnZbr/LsynpzFrJ9FxZvH16bCrt+//MI9GWBuiTJsHwUDPRjZkm40YTGH19GXcssAkw/YM2JZY= +Received: by 10.54.36.58 with SMTP id j58mr477320wrj; + Mon, 18 Jul 2005 12:34:57 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Mon, 18 Jul 2005 12:34:57 -0700 (PDT) +Message-ID: <59d991c405071812342e290f57@mail.gmail.com> +Date: Mon, 18 Jul 2005 15:34:57 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Impact of checkpoint_segments under continual load conditions +Cc: Vivek Khera , pgsql-performance@postgresql.org +In-Reply-To: <16394.1121715156@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: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.123 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/271 +X-Sequence-Number: 13512 + +On 7/18/05, Tom Lane wrote: +> Christopher Petrilli writes: +> > http://blog.amber.org/diagrams/comparison_mysql_pgsql.png +>=20 +> > Notice the VERY steep drop off. +>=20 +> Hmm. Whatever that is, it's not checkpoint's fault. I would interpret +> the regular upticks in the Postgres times (every several hundred +> iterations) as being the effects of checkpoints. You could probably +> smooth out those peaks some with appropriate hacking on bgwriter +> parameters, but that's not the issue at hand (is it?). + +I tried hacking that, turning it up to be more agressive, it got +worse. Turned it down, it got worse :-) +=20 +> I have no idea at all what's causing the sudden falloff in performance +> after about 10000 iterations. COPY per se ought to be about a +> constant-time operation, since APPEND is (or should be) constant-time. +> What indexes, foreign keys, etc do you have on this table? What else +> was going on at the time? + +The table has 15 columns, 5 indexes (character, inet and timestamp). +No foreign keys. The only other thing running on the machine was the +application actually DOING the benchmarking, written in Python +(psycopg), but it was, according to top, using less than 1% of the +CPU. It was just talking through a pipe to a psql prompt to do the +COPY. + +Chris +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Mon Jul 18 17:32:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CF33152AC2 + for ; + Mon, 18 Jul 2005 17:32:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47414-10 + for ; + Mon, 18 Jul 2005 20:32:24 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 55859529A9 + for ; + Mon, 18 Jul 2005 17:32:23 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6IKWNkt016795; + Mon, 18 Jul 2005 16:32:23 -0400 (EDT) +To: Christopher Petrilli +Cc: Vivek Khera , pgsql-performance@postgresql.org +Subject: Re: Impact of checkpoint_segments under continual load conditions +In-reply-to: <59d991c405071812342e290f57@mail.gmail.com> +References: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Mon, 18 Jul 2005 15:34:57 -0400" +Date: Mon, 18 Jul 2005 16:32:23 -0400 +Message-ID: <16794.1121718743@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/272 +X-Sequence-Number: 13513 + +Christopher Petrilli writes: +> On 7/18/05, Tom Lane wrote: +>> I have no idea at all what's causing the sudden falloff in performance +>> after about 10000 iterations. COPY per se ought to be about a +>> constant-time operation, since APPEND is (or should be) constant-time. +>> What indexes, foreign keys, etc do you have on this table? What else +>> was going on at the time? + +> The table has 15 columns, 5 indexes (character, inet and timestamp). +> No foreign keys. The only other thing running on the machine was the +> application actually DOING the benchmarking, written in Python +> (psycopg), but it was, according to top, using less than 1% of the +> CPU. It was just talking through a pipe to a psql prompt to do the +> COPY. + +Sounds pretty plain-vanilla all right. + +Are you in a position to try the same benchmark against CVS tip? +(The nightly snapshot tarball would be plenty close enough.) I'm +just wondering if the old bgwriter behavior of locking down the +bufmgr while it examined the ARC/2Q data structures is causing this... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 18 17:47:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D27DB52AFB + for ; + Mon, 18 Jul 2005 17:47:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50704-08 + for ; + Mon, 18 Jul 2005 20:47:40 +0000 (GMT) +Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.91]) + by svr1.postgresql.org (Postfix) with ESMTP id 8DCB052CDE + for ; + Mon, 18 Jul 2005 17:47:38 -0300 (ADT) +Received: from Courts-MTA by gwmta.wicourts.gov + with Novell_GroupWise; Mon, 18 Jul 2005 15:47:41 -0500 +Message-Id: +X-Mailer: Novell GroupWise Internet Agent 6.5.2 +Date: Mon, 18 Jul 2005 15:47:34 -0500 +From: "Kevin Grittner" +To: , +Subject: Re: join and query planner +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, hits=0.017 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/273 +X-Sequence-Number: 13514 + +You might want to set join_collapse_limit high, and use the JOIN +operators rather than the comma-separated lists. We generate the WHERE +clause on the fly, based on user input, and this has worked well for us. + +-Kevin + + +>>> "Dario" 07/18/05 2:24 PM >>> +Hi. + +> Just out of curiosity, does it do any better with the following? +> +> SELECT ... + +Yes, it does. + +But my query could also be + SELECT ... + FROM a + JOIN b ON (a.key = b.key) + LEFT JOIN c ON (c.key = a.key) + LEFT JOIN d ON (d.key=a.key) +/*new*/ , e + WHERE (b.column <= 100) +/*new*/ and (e.key = a.key) and (e.field = 'filter') + +because it's constructed by an application. I needed to know if, +somehow, +someway, I can "unforce" join order. +The only way to solve it so far is changing application. It must build +something like + + SELECT ... + FROM b + JOIN (a JOIN e ON (e.key = a.key)) ON (a.key = b.key) + LEFT JOIN c ON (c.key = a.key) + LEFT JOIN d ON (d.key=a.key) + WHERE (b.column <= 100) and (e.field = 'filter') + +Supossed that e.field has (should have) better selectivity. But now this +problem belongs to programmer's group :-) + +The query, in fact, has more tables to join. I wonder if lowering geqo +threshold could do the work... + +Thank you. Greetings. Long life, little spam and prosperity! + + +-----Mensaje original----- +De: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org]En nombre de Kevin +Grittner +Enviado el: lunes, 18 de julio de 2005 14:58 +Para: pgsql-performance@postgresql.org; dariop@unitech.com.ar +Asunto: Re: [PERFORM] join and query planner + + +Just out of curiosity, does it do any better with the following? + + SELECT ... + FROM a + JOIN b ON (a.key = b.key) + LEFT JOIN c ON (c.key = a.key) + LEFT JOIN d ON (d.key=a.key) + WHERE (b.column <= 100) + + +>>> snipp + + +---------------------------(end of broadcast)--------------------------- +TIP 5: don't forget to increase your free space map settings + + +From pgsql-performance-owner@postgresql.org Mon Jul 18 20:31:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B201A52BB0 + for ; + Mon, 18 Jul 2005 20:31:41 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11061-10 + for ; + Mon, 18 Jul 2005 23:31:40 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 4382A52BAE + for ; + Mon, 18 Jul 2005 20:31:38 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i32so1093156wra + for ; + Mon, 18 Jul 2005 16:31:42 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=f0WrQ3deGdjBEGTN2q1oYQ2x8FJu7bLD0tmgr0fIdggon0ubd+8xy6j/IFBr2/dOKwQXOHBcx+N2gR8HxsiIf2Pw6J4/XVY1XNfWTAqq8/HLGs1+01Dkh+Yts/F8W++NwLUeJiej2hIJgtc4yQO5fT+K8yQdXC2n7zEoj18xIZY= +Received: by 10.54.38.40 with SMTP id l40mr538132wrl; + Mon, 18 Jul 2005 16:30:53 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Mon, 18 Jul 2005 16:30:53 -0700 (PDT) +Message-ID: <59d991c405071816304af42ef@mail.gmail.com> +Date: Mon, 18 Jul 2005 19:30:53 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Impact of checkpoint_segments under continual load conditions +Cc: Vivek Khera , pgsql-performance@postgresql.org +In-Reply-To: <16794.1121718743@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: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.121 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/274 +X-Sequence-Number: 13515 + +On 7/18/05, Tom Lane wrote: +> Christopher Petrilli writes: +> > On 7/18/05, Tom Lane wrote: +> >> I have no idea at all what's causing the sudden falloff in performance +> >> after about 10000 iterations. COPY per se ought to be about a +> >> constant-time operation, since APPEND is (or should be) constant-time. +> >> What indexes, foreign keys, etc do you have on this table? What else +> >> was going on at the time? +>=20 +> > The table has 15 columns, 5 indexes (character, inet and timestamp). +> > No foreign keys. The only other thing running on the machine was the +> > application actually DOING the benchmarking, written in Python +> > (psycopg), but it was, according to top, using less than 1% of the +> > CPU. It was just talking through a pipe to a psql prompt to do the +> > COPY. +>=20 +> Sounds pretty plain-vanilla all right. +>=20 +> Are you in a position to try the same benchmark against CVS tip? +> (The nightly snapshot tarball would be plenty close enough.) I'm +> just wondering if the old bgwriter behavior of locking down the +> bufmgr while it examined the ARC/2Q data structures is causing this... + +So here's something odd I noticed: + +20735 pgsql 16 0 20640 11m 10m R 48.0 1.2 4:09.65 +postmaster =20 +20734 petrilli 25 0 8640 2108 1368 R 38.1 0.2 4:25.80 psql + +The 47 and 38.1 are %CPU. Why would psql be burning so much CPU? I've +got it attached ,via a pipe to another process that's driving it +(until I implement the protocol for COPY later). I wouldn't think it +should be uing such a huge percentage of the CPU, no? + +The Python script that's actually driving it is about 10% o the CPU, +which is just because it's generating the incoming data on the fly.=20 +Thoughts? + +I will give the CVS head a spin soon, but I wanted to formalize my +benchmarking more first. + +Chris +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Jul 19 05:35:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F401A529C6 + for ; + Tue, 19 Jul 2005 05:35:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66754-06 + for ; + Tue, 19 Jul 2005 08:35:18 +0000 (GMT) +Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) + by svr1.postgresql.org (Postfix) with ESMTP id 295B052983 + for ; + Tue, 19 Jul 2005 05:35:15 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by apate.telenet-ops.be (Postfix) with SMTP id 4657338175 + for ; + Tue, 19 Jul 2005 10:35:17 +0200 (CEST) +Received: from [10.0.1.2] (d5152B1F3.access.telenet.be [81.82.177.243]) + by apate.telenet-ops.be (Postfix) with ESMTP id 6B04B3805D + for ; + Tue, 19 Jul 2005 10:35:16 +0200 (CEST) +Mime-Version: 1.0 (Apple Message framework v622) +In-Reply-To: +References: +Content-Type: multipart/mixed; boundary=Apple-Mail-12--426488437 +Message-Id: <3508d984c33d87fd74c90913aaa24c4d@implements.be> +From: Yves Vindevogel +Subject: Re: Insert performance (OT?) +Date: Tue, 19 Jul 2005 10:35:15 +0200 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/275 +X-Sequence-Number: 13516 + + +--Apple-Mail-12--426488437 +Content-Type: multipart/alternative; + boundary=Apple-Mail-13--426488437 + + +--Apple-Mail-13--426488437 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/plain; + charset=ISO-8859-1; + format=flowed + +nobody ? + +On 18 Jul 2005, at 21:29, Yves Vindevogel wrote: + +> Hi, +> +> Suppose I have a table with 4 fields (f1, f2, f3, f4) +> I define 2 unique indexes u1 (f1, f2, f3) and u2 (f1, f2, f4) +> +> I have 3 records +> A, B, C, D (this will be inserted) +> A, B, C, E (this will pass u2, but not u1, thus not inserted) +> A, B, F, D (this will pass u1, but not u2, thus not inserted) +> +> Now, for performance ... +> +> I have tables like this with 500.000 records where there's a new=20 +> upload of approx. 20.000 records. +> It is only now that we say index u2 to be necessary. So, until now, I=20= + +> did something like insert into ... select f1, f2, f2, max(f4) group by=20= + +> f1, f2, f3 +> That is ok ... and also logically ok because of the data definition +> +> I cannot do this with 2 group by's. I tried this on paper and I'm not=20= + +> succeeding. +> +> So, I must use a function that will check against u1 and u2, and then=20= + +> insert if it is ok. +> I know that such a function is way slower that my insert query. +> +> So, my question ... +> How can I keep the same performance, but also with the new index in=20 +> mind ??? +> +> +> Met vriendelijke groeten, +> Bien =E0 vous, +> Kind regards, +> +> Yves Vindevogel +> Implements +> +> +> +> Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 +> +> Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 +> +> Web: http://www.implements.be +> +> First they ignore you. Then they laugh at you. Then they fight you. =20= + +> Then you win. +> Mahatma Ghandi. +> ---------------------------(end of=20 +> broadcast)--------------------------- +> TIP 5: don't forget to increase your free space map settings +> +Met vriendelijke groeten, +Bien =E0 vous, +Kind regards, + +Yves Vindevogel +Implements + + +--Apple-Mail-13--426488437 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/enriched; + charset=ISO-8859-1 + +nobody ? + + +On 18 Jul 2005, at 21:29, Yves Vindevogel wrote: + + +Hi, + + +Suppose I have a table with 4 fields (f1, f2, f3, f4) + +I define 2 unique indexes u1 (f1, f2, f3) and u2 (f1, f2, f4) + + +I have 3 records + +A, B, C, D (this will be inserted) + +A, B, C, E (this will pass u2, but not u1, thus not inserted) + +A, B, F, D (this will pass u1, but not u2, thus not inserted) + + +Now, for performance ... + + +I have tables like this with 500.000 records where there's a new +upload of approx. 20.000 records. + +It is only now that we say index u2 to be necessary. So, until now, I +did something like insert into ... select f1, f2, f2, max(f4) group by +f1, f2, f3 + +That is ok ... and also logically ok because of the data definition + + +I cannot do this with 2 group by's. I tried this on paper and I'm not +succeeding. + + +So, I must use a function that will check against u1 and u2, and then +insert if it is ok. + +I know that such a function is way slower that my insert query. + + +So, my question ... + +How can I keep the same performance, but also with the new index in +mind ??? + + + +Met vriendelijke groeten, + +Bien =E0 vous, + +Kind regards, + + +Yves Vindevogel + +Implements + + + +< + + +Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 + + +Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 + + +Web: http://www.implements.be + + + +First they ignore you. Then they laugh at you. Then they fight you.=20 +Then you win. + +Mahatma Ghandi. + +---------------------------(end of +broadcast)--------------------------- + +TIP 5: don't forget to increase your free space map settings + + +Met vriendelijke groeten, + +Bien =E0 vous, + +Kind regards, + + +Yves Vindevogel + +Implements + + + += + +--Apple-Mail-13--426488437-- + +--Apple-Mail-12--426488437 +Content-Transfer-Encoding: base64 +Content-Type: image/tiff; + x-unix-mode=0666; + name="Pasted Graphic 2.tiff" +Content-Disposition: inline; + filename="Pasted Graphic 2.tiff" + +TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8Qo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/0KfJqfzop3+p1Aw3+53I7 +n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB +ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA +AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb +AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA +CAAK/IAAACcQAAr8gAAAJxA= + +--Apple-Mail-12--426488437 +Content-Type: multipart/alternative; + boundary=Apple-Mail-14--426488435 + + +--Apple-Mail-14--426488435 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + format=flowed + + + +Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 + +Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 + +Web: http://www.implements.be + +First they ignore you. Then they laugh at you. Then they fight you. +Then you win. +Mahatma Ghandi. + +--Apple-Mail-14--426488435 +Content-Transfer-Encoding: 7bit +Content-Type: text/enriched; + charset=US-ASCII + + + + +Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 + + +Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 + + +Web: http://www.implements.be + + + +First they ignore you. Then they laugh at you. Then they fight you. +Then you win. + +Mahatma Ghandi. + + +--Apple-Mail-14--426488435-- + +--Apple-Mail-12--426488437-- + + +From pgsql-performance-owner@postgresql.org Tue Jul 19 06:49:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3758E528CB + for ; + Tue, 19 Jul 2005 06:49:39 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79689-08 + for ; + Tue, 19 Jul 2005 09:49:37 +0000 (GMT) +Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) + by svr1.postgresql.org (Postfix) with ESMTP id C22F6528C6 + for ; + Tue, 19 Jul 2005 06:49:36 -0300 (ADT) +Received: from mainbox.archonet.com + (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) + by smtp.metronet.co.uk (MetroNet Mail) with ESMTP + id 1CDE8417853; Tue, 19 Jul 2005 10:49:32 +0100 (BST) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP id 2846A15EE6; + Tue, 19 Jul 2005 10:39:11 +0100 (BST) +Received: from mainbox.archonet.com ([127.0.0.1]) + by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 03747-03; Tue, 19 Jul 2005 10:39:07 +0100 (BST) +Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP id 9E5A015EDA; + Tue, 19 Jul 2005 10:39:07 +0100 (BST) +Message-ID: <42DCCA3B.8070100@archonet.com> +Date: Tue, 19 Jul 2005 10:39:07 +0100 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Yves Vindevogel +Cc: pgsql-performance@postgresql.org +Subject: Re: Insert performance (OT?) +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/276 +X-Sequence-Number: 13517 + +Yves Vindevogel wrote: +> Hi, +> +> Suppose I have a table with 4 fields (f1, f2, f3, f4) +> I define 2 unique indexes u1 (f1, f2, f3) and u2 (f1, f2, f4) +> +> I have 3 records +> A, B, C, D (this will be inserted) +> A, B, C, E (this will pass u2, but not u1, thus not inserted) +> A, B, F, D (this will pass u1, but not u2, thus not inserted) + +Are you saying you want to know whether they will be inserted before you +try to do so? + +> Now, for performance ... +> +> I have tables like this with 500.000 records where there's a new upload +> of approx. 20.000 records. +> It is only now that we say index u2 to be necessary. So, until now, I +> did something like insert into ... select f1, f2, f2, max(f4) group by +> f1, f2, f3 +> That is ok ... and also logically ok because of the data definition + +I'm confused here - assuming you meant "select f1,f2,f3", then I don't +see how you guarantee the row doesn't alredy exist. + +> I cannot do this with 2 group by's. I tried this on paper and I'm not +> succeeding. + +I don't see how you can have two group-by's, or what that would mean if +you did. + +> So, I must use a function that will check against u1 and u2, and then +> insert if it is ok. +> I know that such a function is way slower that my insert query. + +So - you have a table, called something like "upload" with 20,000 rows +and you'd like to know whether it is safe to insert them. Well, it's +easy enough to identify which ones are duplicates. + +SELECT * FROM upload JOIN main_table ON u1=f1 AND u2=f2 AND u3=f3; +SELECT * FROM upload JOIN main_table ON u1=f1 AND u2=f2 AND u3=f4; + +Are you saying that deleting these rows and then inserting takes too long? + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Tue Jul 19 07:21:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6082D528C3 + for ; + Tue, 19 Jul 2005 07:21:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 86374-09 + for ; + Tue, 19 Jul 2005 10:21:09 +0000 (GMT) +Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) + by svr1.postgresql.org (Postfix) with ESMTP id 18AFB5288D + for ; + Tue, 19 Jul 2005 07:21:07 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by apate.telenet-ops.be (Postfix) with SMTP id 3C03C38139 + for ; + Tue, 19 Jul 2005 12:21:10 +0200 (CEST) +Received: from [10.0.1.2] (d5152B1F3.access.telenet.be [81.82.177.243]) + by apate.telenet-ops.be (Postfix) with ESMTP id 14019380D5 + for ; + Tue, 19 Jul 2005 12:21:09 +0200 (CEST) +Mime-Version: 1.0 (Apple Message framework v622) +To: pgsql-performance@postgresql.org +Message-Id: <940bb98041b7df475b53f98e35c31ce2@implements.be> +Content-Type: multipart/mixed; boundary=Apple-Mail-29--420135631 +From: Yves Vindevogel +Subject: Fwd: Insert performance (OT?) +Date: Tue, 19 Jul 2005 12:21:08 +0200 +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/277 +X-Sequence-Number: 13518 + + +--Apple-Mail-29--420135631 +Content-Type: multipart/alternative; + boundary=Apple-Mail-30--420135631 + + +--Apple-Mail-30--420135631 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/plain; + charset=ISO-8859-1; + format=flowed + +BTW: thank you for the idea + +Begin forwarded message: + +> From: Yves Vindevogel +> Date: Tue 19 Jul 2005 12:20:34 CEST +> To: Richard Huxton +> Subject: Re: [PERFORM] Insert performance (OT?) +> +> +> On 19 Jul 2005, at 11:39, Richard Huxton wrote: +> +>> Yves Vindevogel wrote: +>>> Hi, +>>> Suppose I have a table with 4 fields (f1, f2, f3, f4) +>>> I define 2 unique indexes u1 (f1, f2, f3) and u2 (f1, f2, f4) +>>> I have 3 records +>>> A, B, C, D (this will be inserted) +>>> A, B, C, E (this will pass u2, but not u1, thus not inserted) +>>> A, B, F, D (this will pass u1, but not u2, thus not inserted) +>> +>> Are you saying you want to know whether they will be inserted before=20= + +>> you try to do so? +>> +> No, that is not an issue. Problem is that when I use a big query with=20= + +> "insert into .. select" and one record is wrong (like above) the=20 +> complete insert query is abandonned. +> Therefore, I must do it another way. Or I must be able to say, insert=20= + +> them and dump the rest. +> +>>> Now, for performance ... +>>> I have tables like this with 500.000 records where there's a new=20 +>>> upload of approx. 20.000 records. +>>> It is only now that we say index u2 to be necessary. So, until now,=20= + +>>> I did something like insert into ... select f1, f2, f2, max(f4)=20 +>>> group by f1, f2, f3 +>>> That is ok ... and also logically ok because of the data definition +>> +>> I'm confused here - assuming you meant "select f1,f2,f3", then I=20 +>> don't see how you guarantee the row doesn't alredy exist. +>> +> No, I meant it with max(f4) because my table has 4 fields. And no, I=20= + +> can't guarantee that, that is exactly my problem. +> But with the unique indexes, I'm certain that it will not get into my=20= + +> database +> +>>> I cannot do this with 2 group by's. I tried this on paper and I'm=20= + +>>> not succeeding. +>> +>> I don't see how you can have two group-by's, or what that would mean=20= + +>> if you did. +>> +> select from ( select from group by) as foo group by +> +>>> So, I must use a function that will check against u1 and u2, and=20 +>>> then insert if it is ok. +>>> I know that such a function is way slower that my insert query. +>> +>> So - you have a table, called something like "upload" with 20,000=20 +>> rows and you'd like to know whether it is safe to insert them. Well,=20= + +>> it's easy enough to identify which ones are duplicates. +>> +>> SELECT * FROM upload JOIN main_table ON u1=3Df1 AND u2=3Df2 AND = +u3=3Df3; +>> SELECT * FROM upload JOIN main_table ON u1=3Df1 AND u2=3Df2 AND = +u3=3Df4; +>> +> That is a good idea. I can delete the ones that would fail my first=20= + +> unique index this way, and then delete the ones that would fail my=20 +> second unique index and then upload them. +> Hmm, why did I not think of that myself. +> +>> Are you saying that deleting these rows and then inserting takes too=20= + +>> long? +>> +> This goes very fast, but not with a function that checks each record=20= + +> one by one. +> +>> -- +>> Richard Huxton +>> Archonet Ltd +>> +>> ---------------------------(end of=20 +>> broadcast)--------------------------- +>> TIP 6: explain analyze is your friend +>> +>> +> Met vriendelijke groeten, +> Bien =E0 vous, +> Kind regards, +> +> Yves Vindevogel +> Implements +> + +--Apple-Mail-30--420135631 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/enriched; + charset=ISO-8859-1 + +BTW: thank you for the idea + + +Begin forwarded message: + + +0000,0000,0000From: +Yves Vindevogel < + +0000,0000,0000Date: Tue 19 +Jul 2005 12:20:34 CEST + +0000,0000,0000To: Richard +Huxton < + +0000,0000,0000Subject: Re: +[PERFORM] Insert performance (OT?) + + + + +On 19 Jul 2005, at 11:39, Richard Huxton wrote: + + +Yves Vindevogel wrote: + +Hi, + +Suppose I have a table with 4 fields (f1, f2, f3, f4) + +I define 2 unique indexes u1 (f1, f2, f3) and u2 (f1, f2, f4) + +I have 3 records + +A, B, C, D (this will be inserted) + +A, B, C, E (this will pass u2, but not u1, thus not inserted) + +A, B, F, D (this will pass u1, but not u2, thus not inserted) + + + +Are you saying you want to know whether they will be inserted before +you try to do so? + + +No, that is not an issue. Problem is that when I use a big +query with "insert into .. select" and one record is wrong (like +above) the complete insert query is abandonned. + +Therefore, I must do it another way. Or I must be able to say, insert +them and dump the rest. + + +Now, for performance ... + +I have tables like this with 500.000 records where there's a new +upload of approx. 20.000 records. + +It is only now that we say index u2 to be necessary. So, until now, I +did something like insert into ... select f1, f2, f2, max(f4) group by +f1, f2, f3 + +That is ok ... and also logically ok because of the data definition + + + +I'm confused here - assuming you meant "select f1,f2,f3", then I don't +see how you guarantee the row doesn't alredy exist. + + +No, I meant it with max(f4) because my table has 4 fields.=20 +And no, I can't guarantee that, that is exactly my problem. + +But with the unique indexes, I'm certain that it will not get into my +database + + +I cannot do this with 2 group by's. I tried this on +paper and I'm not succeeding. + + + +I don't see how you can have two group-by's, or what that would mean +if you did. + + +select from ( select from group by) as foo group by + + +So, I must use a function that will check against u1 +and u2, and then insert if it is ok. + +I know that such a function is way slower that my insert query. + + + +So - you have a table, called something like "upload" with 20,000 rows +and you'd like to know whether it is safe to insert them. Well, it's +easy enough to identify which ones are duplicates. + + +SELECT * FROM upload JOIN main_table ON u1=3Df1 AND u2=3Df2 AND u3=3Df3; + +SELECT * FROM upload JOIN main_table ON u1=3Df1 AND u2=3Df2 AND u3=3Df4; + + +That is a good idea. I can delete the ones that would fail +my first unique index this way, and then delete the ones that would +fail my second unique index and then upload them. + +Hmm, why did I not think of that myself. + + +Are you saying that deleting these rows and then inserting +takes too long? + + +This goes very fast, but not with a function that checks +each record one by one. + + +-- + + Richard Huxton + + Archonet Ltd + + +---------------------------(end of +broadcast)--------------------------- + +TIP 6: explain analyze is your friend + + + +Met vriendelijke groeten, + +Bien =E0 vous, + +Kind regards, + + +Yves Vindevogel + +Implements + + + += + +--Apple-Mail-30--420135631-- + +--Apple-Mail-29--420135631 +Content-Transfer-Encoding: base64 +Content-Type: image/tiff; + x-unix-mode=0666; + name="Pasted Graphic 2.tiff" +Content-Disposition: inline; + filename="Pasted Graphic 2.tiff" + +TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP +8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho +9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ +RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP +8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr +RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ +B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T +bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D +pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy +nVzX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n3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf +1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs +DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa +FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC +MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW +/0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 +n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB +ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA +AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb +AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA +CAAK/IAAACcQAAr8gAAAJxA= + +--Apple-Mail-29--420135631 +Content-Type: multipart/alternative; + boundary=Apple-Mail-31--420135629 + + +--Apple-Mail-31--420135629 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/plain; + charset=ISO-8859-1; + format=flowed + +> +> +> Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 +> +> Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 +> +> Web: http://www.implements.be +> +> First they ignore you. Then they laugh at you. Then they fight you. =20= + +> Then you win. +> Mahatma Ghandi. +> +Met vriendelijke groeten, +Bien =E0 vous, +Kind regards, + +Yves Vindevogel +Implements + + +--Apple-Mail-31--420135629 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/enriched; + charset=ISO-8859-1 + + + + +Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 + + +Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 + + +Web: http://www.implements.be + + + +First they ignore you. Then they laugh at you. Then they fight you.=20 +Then you win. + +Mahatma Ghandi. + + +Met vriendelijke groeten, + +Bien =E0 vous, + +Kind regards, + + +Yves Vindevogel + +Implements + + + += + +--Apple-Mail-31--420135629-- + +--Apple-Mail-29--420135631 +Content-Transfer-Encoding: base64 +Content-Type: image/tiff; + x-unix-mode=0666; + name="Pasted Graphic 2.tiff" +Content-Disposition: inline; + filename="Pasted Graphic 2.tiff" + +TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP +8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho +9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ +RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP +8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr +RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ +B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T +bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZt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LP006EG8 +G2X35LbnK6B/5iH+GcGSs8FoFehCC0CYEavXAT5WRSDyDdxACKBtvwFwFkJqHEHAUVxeLACSB3HZ +2GNKEyEgP6EsEaNEKQCn3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf +1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs +DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa +FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC +MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW +/0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 +n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB +ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA +AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb +AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA +CAAK/IAAACcQAAr8gAAAJxA= + +--Apple-Mail-29--420135631 +Content-Type: multipart/alternative; + boundary=Apple-Mail-32--420135628 + + +--Apple-Mail-32--420135628 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + format=flowed + + + +Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 + +Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 + +Web: http://www.implements.be + +First they ignore you. Then they laugh at you. Then they fight you. +Then you win. +Mahatma Ghandi. + +--Apple-Mail-32--420135628 +Content-Transfer-Encoding: 7bit +Content-Type: text/enriched; + charset=US-ASCII + + + + +Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 + + +Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 + + +Web: http://www.implements.be + + + +First they ignore you. Then they laugh at you. Then they fight you. +Then you win. + +Mahatma Ghandi. + + +--Apple-Mail-32--420135628-- + +--Apple-Mail-29--420135631-- + + +From pgsql-performance-owner@postgresql.org Tue Jul 19 08:00:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C57DF52914 + for ; + Tue, 19 Jul 2005 08:00:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95493-02 + for ; + Tue, 19 Jul 2005 11:00:41 +0000 (GMT) +Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) + by svr1.postgresql.org (Postfix) with ESMTP id 4564E5293E + for ; + Tue, 19 Jul 2005 08:00:37 -0300 (ADT) +Received: from mainbox.archonet.com + (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) + by smtp.metronet.co.uk (MetroNet Mail) with ESMTP + id 517294183D5; Tue, 19 Jul 2005 12:00:20 +0100 (BST) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP id 9600F15EE6; + Tue, 19 Jul 2005 11:51:55 +0100 (BST) +Received: from mainbox.archonet.com ([127.0.0.1]) + by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 04342-02; Tue, 19 Jul 2005 11:51:52 +0100 (BST) +Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP id 1CD3815EDA; + Tue, 19 Jul 2005 11:51:52 +0100 (BST) +Message-ID: <42DCDB47.3060009@archonet.com> +Date: Tue, 19 Jul 2005 11:51:51 +0100 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Yves Vindevogel +Cc: 'Postgresql Performance' +Subject: Re: Insert performance (OT?) +References: + <42DCCA3B.8070100@archonet.com> + +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/278 +X-Sequence-Number: 13519 + +Yves Vindevogel wrote: + >>> So, I must use a function that will check against u1 and u2, and then +>>> insert if it is ok. +>>> I know that such a function is way slower that my insert query. +>> +>> So - you have a table, called something like "upload" with 20,000 rows +>> and you'd like to know whether it is safe to insert them. Well, it's +>> easy enough to identify which ones are duplicates. +>> +>> SELECT * FROM upload JOIN main_table ON u1=f1 AND u2=f2 AND u3=f3; +>> SELECT * FROM upload JOIN main_table ON u1=f1 AND u2=f2 AND u3=f4; +>> +> That is a good idea. I can delete the ones that would fail my first +> unique index this way, and then delete the ones that would fail my +> second unique index and then upload them. +> Hmm, why did I not think of that myself. + +I've spent a lot of time moving data from one system to another, usually +having to clean it in the process. At 9pm on a Friday, you decide that +on the next job you'll find an efficient way to do it :-) + +>> Are you saying that deleting these rows and then inserting takes too +>> long? +>> +> This goes very fast, but not with a function that checks each record one +> by one. + +You could get away with one query if you converted them to left-joins: +INSERT INTO ... +SELECT * FROM upload LEFT JOIN ... WHERE f3 IS NULL +UNION +SELECT * FROM upload LEFT JOIN ... WHERE f4 IS NULL + +The UNION will remove duplicates for you, but this might turn out to be +slower than two separate queries. + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Tue Jul 19 10:38:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5FEC7528C3 + for ; + Tue, 19 Jul 2005 10:38:41 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 33527-02 + for ; + Tue, 19 Jul 2005 13:38:35 +0000 (GMT) +Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) + by svr1.postgresql.org (Postfix) with ESMTP id E7B2852818 + for ; + Tue, 19 Jul 2005 10:38:34 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by apate.telenet-ops.be (Postfix) with SMTP id 7872F380DD + for ; + Tue, 19 Jul 2005 15:38:37 +0200 (CEST) +Received: from [10.0.1.2] (d5152B1F3.access.telenet.be [81.82.177.243]) + by apate.telenet-ops.be (Postfix) with ESMTP id DA491380F2 + for ; + Tue, 19 Jul 2005 15:38:36 +0200 (CEST) +Mime-Version: 1.0 (Apple Message framework v622) +In-Reply-To: <42DCDB47.3060009@archonet.com> +References: + <42DCCA3B.8070100@archonet.com> + + <42DCDB47.3060009@archonet.com> +Content-Type: multipart/mixed; boundary=Apple-Mail-62--408288062 +Message-Id: <646c7b05563f9d76b5492de416f7432a@implements.be> +From: Yves Vindevogel +Subject: Re: Insert performance (OT?) +Date: Tue, 19 Jul 2005 15:38:36 +0200 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.622) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/279 +X-Sequence-Number: 13520 + + +--Apple-Mail-62--408288062 +Content-Type: multipart/alternative; + boundary=Apple-Mail-63--408288062 + + +--Apple-Mail-63--408288062 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/plain; + charset=ISO-8859-1; + format=flowed + +I will use 2 queries. They run within a function fnUpload(), so I'm=20 +going to keep it simple. + + +On 19 Jul 2005, at 12:51, Richard Huxton wrote: + +> Yves Vindevogel wrote: +> >>> So, I must use a function that will check against u1 and u2, and=20= + +> then +>>>> insert if it is ok. +>>>> I know that such a function is way slower that my insert query. +>>> +>>> So - you have a table, called something like "upload" with 20,000=20 +>>> rows and you'd like to know whether it is safe to insert them. Well,=20= + +>>> it's easy enough to identify which ones are duplicates. +>>> +>>> SELECT * FROM upload JOIN main_table ON u1=3Df1 AND u2=3Df2 AND = +u3=3Df3; +>>> SELECT * FROM upload JOIN main_table ON u1=3Df1 AND u2=3Df2 AND = +u3=3Df4; +>>> +>> That is a good idea. I can delete the ones that would fail my first=20= + +>> unique index this way, and then delete the ones that would fail my=20 +>> second unique index and then upload them. +>> Hmm, why did I not think of that myself. +> +> I've spent a lot of time moving data from one system to another,=20 +> usually having to clean it in the process. At 9pm on a Friday, you=20 +> decide that on the next job you'll find an efficient way to do it :-) +> +>>> Are you saying that deleting these rows and then inserting takes too=20= + +>>> long? +>>> +>> This goes very fast, but not with a function that checks each record=20= + +>> one by one. +> +> You could get away with one query if you converted them to left-joins: +> INSERT INTO ... +> SELECT * FROM upload LEFT JOIN ... WHERE f3 IS NULL +> UNION +> SELECT * FROM upload LEFT JOIN ... WHERE f4 IS NULL +> +> The UNION will remove duplicates for you, but this might turn out to=20= + +> be slower than two separate queries. +> +> -- +> Richard Huxton +> Archonet Ltd +> +> +Met vriendelijke groeten, +Bien =E0 vous, +Kind regards, + +Yves Vindevogel +Implements + + +--Apple-Mail-63--408288062 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/enriched; + charset=ISO-8859-1 + +I will use 2 queries. They run within a function fnUpload(), so I'm +going to keep it simple. + + + +On 19 Jul 2005, at 12:51, Richard Huxton wrote: + + +Yves Vindevogel wrote: + + >>> So, I must use a function that will check against u1 and u2, and +then + +insert if it is ok. + +I know that such a function is way slower that my insert query. + + + +So - you have a table, called something like "upload" with 20,000 rows +and you'd like to know whether it is safe to insert them. Well, it's +easy enough to identify which ones are duplicates. + + +SELECT * FROM upload JOIN main_table ON u1=3Df1 AND u2=3Df2 AND u3=3Df3; + +SELECT * FROM upload JOIN main_table ON u1=3Df1 AND u2=3Df2 AND u3=3Df4; + + +That is a good idea. I can delete the ones that would fail +my first unique index this way, and then delete the ones that would +fail my second unique index and then upload them. + +Hmm, why did I not think of that myself. + + + +I've spent a lot of time moving data from one system to another, +usually having to clean it in the process. At 9pm on a Friday, you +decide that on the next job you'll find an efficient way to do it :-) + + +Are you saying that deleting these rows and then +inserting takes too long? + + +This goes very fast, but not with a function that checks +each record one by one. + + + +You could get away with one query if you converted them to left-joins: + +INSERT INTO ... + +SELECT * FROM upload LEFT JOIN ... WHERE f3 IS NULL + +UNION + +SELECT * FROM upload LEFT JOIN ... WHERE f4 IS NULL + + +The UNION will remove duplicates for you, but this might turn out to +be slower than two separate queries. + + +-- + + Richard Huxton + + Archonet Ltd + + + +Met vriendelijke groeten, + +Bien =E0 vous, + +Kind regards, + + +Yves Vindevogel + +Implements + + + += + +--Apple-Mail-63--408288062-- + +--Apple-Mail-62--408288062 +Content-Transfer-Encoding: base64 +Content-Type: image/tiff; + x-unix-mode=0666; + name="Pasted Graphic 2.tiff" +Content-Disposition: inline; + filename="Pasted Graphic 2.tiff" + +TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP +8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho +9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ +RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP +8rKJov9UtFzv9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UAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA +CAAK/IAAACcQAAr8gAAAJxA= + +--Apple-Mail-62--408288062 +Content-Type: multipart/alternative; + boundary=Apple-Mail-64--408288060 + + +--Apple-Mail-64--408288060 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + format=flowed + + + +Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 + +Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 + +Web: http://www.implements.be + +First they ignore you. Then they laugh at you. Then they fight you. +Then you win. +Mahatma Ghandi. + +--Apple-Mail-64--408288060 +Content-Transfer-Encoding: 7bit +Content-Type: text/enriched; + charset=US-ASCII + + + + +Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 + + +Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 + + +Web: http://www.implements.be + + + +First they ignore you. Then they laugh at you. Then they fight you. +Then you win. + +Mahatma Ghandi. + + +--Apple-Mail-64--408288060-- + +--Apple-Mail-62--408288062-- + + +From pgsql-performance-owner@postgresql.org Tue Jul 19 11:49:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AD4855286A + for ; + Tue, 19 Jul 2005 11:49:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 49865-01 + for ; + Tue, 19 Jul 2005 14:49:06 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) + by svr1.postgresql.org (Postfix) with ESMTP id F15A952995 + for ; + Tue, 19 Jul 2005 11:49:05 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i35so1210895wra + for ; + Tue, 19 Jul 2005 07:49:10 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=mhQ0B63ZLQYyzMAVfvQujUqo4yn7S6vRV/eccVvASR+wKrY/MBh3j3eotGoofM1GNySAFXemSreRhyrao6Qh0bpJakI4mo/hOePvdnfIcGL38armR0gnx0oiLZYNIRQWvyd7345NuzWbiIUQLiMyYg11VMErjTgoHK30N6/z9vA= +Received: by 10.54.50.62 with SMTP id x62mr752726wrx; + Tue, 19 Jul 2005 07:48:42 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Tue, 19 Jul 2005 07:48:42 -0700 (PDT) +Message-ID: <59d991c405071907482bb0689b@mail.gmail.com> +Date: Tue, 19 Jul 2005 10:48:42 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Impact of checkpoint_segments under continual load conditions +Cc: Vivek Khera , pgsql-performance@postgresql.org +In-Reply-To: <16794.1121718743@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: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.164 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/280 +X-Sequence-Number: 13521 + +On 7/18/05, Tom Lane wrote: +> > The table has 15 columns, 5 indexes (character, inet and timestamp). +> > No foreign keys. The only other thing running on the machine was the +> > application actually DOING the benchmarking, written in Python +> > (psycopg), but it was, according to top, using less than 1% of the +> > CPU. It was just talking through a pipe to a psql prompt to do the +> > COPY. +>=20 +> Sounds pretty plain-vanilla all right. +>=20 +> Are you in a position to try the same benchmark against CVS tip? +> (The nightly snapshot tarball would be plenty close enough.) I'm +> just wondering if the old bgwriter behavior of locking down the +> bufmgr while it examined the ARC/2Q data structures is causing this... + +Tom, + +It looks like the CVS HEAD is definately "better," but not by a huge +amount. The only difference is I wasn't run autovacuum in the +background (default settings), but I don't think this explains it.=20 +Here's a graph of the differences and density of behavior: + +http://blog.amber.org/diagrams/pgsql_copy_803_cvs.png + +I can provide the raw data. Each COPY was 500 rows. Note that fsync +is turned off here. Maybe it'd be more stable with it turned on? + +Chris +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Jul 19 12:04:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 547DE52997 + for ; + Tue, 19 Jul 2005 12:04:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48921-10 + for ; + Tue, 19 Jul 2005 15:04:40 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BAF5D52989 + for ; + Tue, 19 Jul 2005 12:04:38 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6JF4UHp024015; + Tue, 19 Jul 2005 11:04:30 -0400 (EDT) +To: Christopher Petrilli +Cc: Vivek Khera , pgsql-performance@postgresql.org +Subject: Re: Impact of checkpoint_segments under continual load conditions +In-reply-to: <59d991c405071907482bb0689b@mail.gmail.com> +References: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Tue, 19 Jul 2005 10:48:42 -0400" +Date: Tue, 19 Jul 2005 11:04:30 -0400 +Message-ID: <24014.1121785470@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/281 +X-Sequence-Number: 13522 + +Christopher Petrilli writes: +> Here's a graph of the differences and density of behavior: + +> http://blog.amber.org/diagrams/pgsql_copy_803_cvs.png + +> I can provide the raw data. + +How about the complete test case? There's something awfully odd going +on there, and I'd like to find out what. + +> Note that fsync is turned off here. Maybe it'd be more stable with it +> turned on? + +Hard to say. I was about to ask if you'd experimented with altering +configuration parameters such as shared_buffers or checkpoint_segments +to see if you can move the point of onset of slowdown. I'm thinking +the behavioral change might be associated with running out of free +buffers or some such. (Are you running these tests under a freshly- +started postmaster, or one that's been busy for awhile?) + + regards, tom lane + +From pgsql-patches-owner@postgresql.org Tue Jul 19 12:23:25 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1654D52A15 + for ; + Tue, 19 Jul 2005 12:23:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54593-07 + for ; + Tue, 19 Jul 2005 15:23:22 +0000 (GMT) +Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) + by svr1.postgresql.org (Postfix) with ESMTP id 8052F52A14 + for ; + Tue, 19 Jul 2005 12:23:21 -0300 (ADT) +Received: from [192.168.1.103] (cpe-024-211-165-134.nc.res.rr.com + [24.211.165.134]) (authenticated (0 bits)) + by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id j6JEbo528179; + Tue, 19 Jul 2005 09:37:50 -0500 +Message-ID: <42DD1AE6.6020204@dunslane.net> +Date: Tue, 19 Jul 2005 11:23:18 -0400 +From: Andrew Dunstan +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.8) Gecko/20050513 Fedora/1.7.8-1.3.1 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Alon Goldshuv +Cc: pgsql-patches@postgresql.org +Subject: Re: COPY FROM performance improvements +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/377 +X-Sequence-Number: 16717 + + + +Alon Goldshuv wrote: + +>I revisited my patch and removed the code duplications that were there, and +>added support for CSV with buffered input, so CSV now runs faster too +>(although it is not as optimized as the TEXT format parsing). So now +>TEXT,CSV and BINARY are all parsed in CopyFrom(), like in the original file. +> +>Patch attached. +> +> +> + +I do not have time to review this 2900 line patch analytically, nor to +benchmark it. I have done some functional testing of it on Windows, and +tried to break it in text and CSV modes, and with both Unix and Windows +type line endings - I have not observed any breakage. + +This does need lots of eyeballs, though. + +cheers + +andrew + +From pgsql-performance-owner@postgresql.org Tue Jul 19 12:33:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DF32D52A22 + for ; + Tue, 19 Jul 2005 12:33:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59115-05 + for ; + Tue, 19 Jul 2005 15:33:25 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 39BC0529DE + for ; + Tue, 19 Jul 2005 12:33:23 -0300 (ADT) +Received: (qmail 10631 invoked from network); 19 Jul 2005 17:33:57 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 19 Jul 2005 17:33:57 +0200 +To: "Christopher Petrilli" , + "Tom Lane" +Cc: "Vivek Khera" , pgsql-performance@postgresql.org +Subject: Re: Impact of checkpoint_segments under continual load conditions +References: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> +Message-ID: +Date: Tue, 19 Jul 2005 17:33:21 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <59d991c405071907482bb0689b@mail.gmail.com> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/282 +X-Sequence-Number: 13523 + + + What happens if, say at iteration 6000 (a bit after the mess starts), you +pause it for a few minutes and resume. Will it restart with a plateau like +at the beginning of the test ? or not ? + What if, during this pause, you disconnect and reconnect, or restart the +postmaster, or vacuum, or analyze ? + + +> On 7/18/05, Tom Lane wrote: +>> > The table has 15 columns, 5 indexes (character, inet and timestamp). +>> > No foreign keys. The only other thing running on the machine was the +>> > application actually DOING the benchmarking, written in Python +>> > (psycopg), but it was, according to top, using less than 1% of the +>> > CPU. It was just talking through a pipe to a psql prompt to do the +>> > COPY. +>> +>> Sounds pretty plain-vanilla all right. +>> +>> Are you in a position to try the same benchmark against CVS tip? +>> (The nightly snapshot tarball would be plenty close enough.) I'm +>> just wondering if the old bgwriter behavior of locking down the +>> bufmgr while it examined the ARC/2Q data structures is causing this... +> +> Tom, +> +> It looks like the CVS HEAD is definately "better," but not by a huge +> amount. The only difference is I wasn't run autovacuum in the +> background (default settings), but I don't think this explains it. +> Here's a graph of the differences and density of behavior: +> +> http://blog.amber.org/diagrams/pgsql_copy_803_cvs.png +> +> I can provide the raw data. Each COPY was 500 rows. Note that fsync +> is turned off here. Maybe it'd be more stable with it turned on? +> +> Chris + + + +From pgsql-performance-owner@postgresql.org Tue Jul 19 12:44:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 723FF5286A + for ; + Tue, 19 Jul 2005 12:44:41 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62414-03 + for ; + Tue, 19 Jul 2005 15:44:39 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) + by svr1.postgresql.org (Postfix) with ESMTP id 1BFB35285B + for ; + Tue, 19 Jul 2005 12:44:36 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 57so1223174wri + for ; + Tue, 19 Jul 2005 08:44:36 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=uPps7EP+uLyRHLl77uFz1KEljA8tvCkvzVdw35RgQpCpfXmO3rly/UduK0PemS6d24rtN7ycDz1H3cZc8yItj85cQl+5AzcmfjQ+Cb/dledHobUeaGGWWceRVzm3unWSgBM1OqJYkMApuej/CL//bLl+WlyOMCLL6ah9bgP3fms= +Received: by 10.54.24.49 with SMTP id 49mr773923wrx; + Tue, 19 Jul 2005 08:44:00 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Tue, 19 Jul 2005 08:44:00 -0700 (PDT) +Message-ID: <59d991c4050719084460b376f1@mail.gmail.com> +Date: Tue, 19 Jul 2005 11:44:00 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: PFC , Vivek Khera , + Tom Lane +Subject: Re: Impact of checkpoint_segments under continual load conditions +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: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.161 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/283 +X-Sequence-Number: 13524 + +On 7/19/05, PFC wrote: +>=20 +> What happens if, say at iteration 6000 (a bit after the mess star= +ts), you +> pause it for a few minutes and resume. Will it restart with a plateau lik= +e +> at the beginning of the test ? or not ? + +Not sure... my benchmark is designed to represent what the database +will do under "typical" circumstances, and unfortunately these are +typical for the application. However, I can see about adding some +delays, though multiple minutes would be absurd in the application.=20 +Perhaps a 5-10 second day? Would that still be interesting? + +> What if, during this pause, you disconnect and reconnect, or rest= +art the +> postmaster, or vacuum, or analyze ? + +Well, I don't have the numbers any more, but restarting the postmaster +has no effect, other than the first few hundreds COPYs are worse than +anything (3-4x slower), but then it goes back to following the trend +line. The data in the chart for v8.0.3 includes running pg_autovacuum +(5 minutes). + +Chris +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Jul 19 12:57:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 465B752998 + for ; + Tue, 19 Jul 2005 12:57:41 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63494-03 + for ; + Tue, 19 Jul 2005 15:57:36 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 7E52552995 + for ; + Tue, 19 Jul 2005 12:57:35 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6JFvRCK004542; + Tue, 19 Jul 2005 11:57:27 -0400 (EDT) +To: Christopher Petrilli +Cc: PFC , Vivek Khera , + pgsql-performance@postgresql.org +Subject: Re: Impact of checkpoint_segments under continual load conditions +In-reply-to: <59d991c4050719084460b376f1@mail.gmail.com> +References: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> + + <59d991c4050719084460b376f1@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Tue, 19 Jul 2005 11:44:00 -0400" +Date: Tue, 19 Jul 2005 11:57:27 -0400 +Message-ID: <4541.1121788647@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/284 +X-Sequence-Number: 13525 + +Christopher Petrilli writes: +> On 7/19/05, PFC wrote: +>> What happens if, say at iteration 6000 (a bit after the mess starts), you +>> pause it for a few minutes and resume. Will it restart with a plateau like +>> at the beginning of the test ? or not ? + +> Not sure... my benchmark is designed to represent what the database +> will do under "typical" circumstances, and unfortunately these are +> typical for the application. However, I can see about adding some +> delays, though multiple minutes would be absurd in the application. +> Perhaps a 5-10 second day? Would that still be interesting? + +I think PFC's question was not directed towards modeling your +application, but about helping us understand what is going wrong +(so we can fix it). It seemed like a good idea to me. + +> Well, I don't have the numbers any more, but restarting the postmaster +> has no effect, other than the first few hundreds COPYs are worse than +> anything (3-4x slower), but then it goes back to following the trend +> line. The data in the chart for v8.0.3 includes running pg_autovacuum +> (5 minutes). + +The startup transient probably corresponds to the extra I/O needed to +repopulate shared buffers with a useful subset of your indexes. But +just to be perfectly clear: you tried this, and after the startup +transient it returned to the *original* trend line? In particular, +the performance goes into the tank after about 5000 total iterations, +and not 5000 iterations after the postmaster restart? + +I'm suddenly wondering if the performance dropoff corresponds to the +point where the indexes have grown large enough to not fit in shared +buffers anymore. If I understand correctly, the 5000-iterations mark +corresponds to 2.5 million total rows in the table; with 5 indexes +you'd have 12.5 million index entries or probably a couple hundred MB +total. If the insertion pattern is sufficiently random that the entire +index ranges are "hot" then you might not have enough RAM. + +Again, experimenting with different values of shared_buffers seems like +a very worthwhile thing to do. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jul 19 13:25:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 71A3F528BB + for ; + Tue, 19 Jul 2005 13:25:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68400-08 + for ; + Tue, 19 Jul 2005 16:25:51 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 7ADC15285B + for ; + Tue, 19 Jul 2005 13:25:49 -0300 (ADT) +Received: (qmail 13202 invoked from network); 19 Jul 2005 18:26:24 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 19 Jul 2005 18:26:24 +0200 +To: "Tom Lane" , + "Christopher Petrilli" +Cc: "Vivek Khera" , pgsql-performance@postgresql.org +Subject: Re: Impact of checkpoint_segments under continual load conditions +References: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> + + <59d991c4050719084460b376f1@mail.gmail.com> + <4541.1121788647@sss.pgh.pa.us> +Message-ID: +Date: Tue, 19 Jul 2005 18:25:48 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <4541.1121788647@sss.pgh.pa.us> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/285 +X-Sequence-Number: 13526 + + + +> I think PFC's question was not directed towards modeling your +> application, but about helping us understand what is going wrong +> (so we can fix it). + + Exactly, I was wondering if this delay would allow things to get flushed, +for instance, which would give information about the problem (if giving it +a few minutes of rest resumed normal operation, it would mean that some +buffer somewhere is getting filled faster than it can be flushed). + + So, go ahead with a few minutes even if it's unrealistic, that is not the +point, you have to tweak it in various possible manners to understand the +causes. + + And instead of a pause, why not just set the duration of your test to +6000 iterations and run it two times without dropping the test table ? + + I'm going into wild guesses, but first you should want to know if the +problem is because the table is big, or if it's something else. So you run +the complete test, stopping a bit after it starts to make a mess, then +instead of dumping the table and restarting the test anew, you leave it as +it is, do something, then run a new test, but on this table which already +has data. + + 'something' could be one of those : + disconnect, reconnect (well you'll have to do that if you run the test +twice anyway) + just wait + restart postgres + unmount and remount the volume with the logs/data on it + reboot the machine + analyze + vacuum + vacuum analyze + cluster + vacuum full + reindex + defrag your files on disk (stopping postgres and copying the database + from your disk to anotherone and back will do) + or even dump'n'reload the whole database + + I think useful information can be extracted that way. If one of these +fixes your problem it'l give hints. + +From pgsql-performance-owner@postgresql.org Tue Jul 19 13:27:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2262A52998 + for ; + Tue, 19 Jul 2005 13:27:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70648-02 + for ; + Tue, 19 Jul 2005 16:27:25 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 4208452863 + for ; + Tue, 19 Jul 2005 13:27:23 -0300 (ADT) +Received: (qmail 13247 invoked from network); 19 Jul 2005 18:27:57 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 19 Jul 2005 18:27:57 +0200 +To: "Tom Lane" , + "Christopher Petrilli" +Cc: "Vivek Khera" , pgsql-performance@postgresql.org +Subject: Re: Impact of checkpoint_segments under continual load conditions +References: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> + + <59d991c4050719084460b376f1@mail.gmail.com> + <4541.1121788647@sss.pgh.pa.us> +Message-ID: +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Date: Tue, 19 Jul 2005 18:27:21 +0200 +In-Reply-To: <4541.1121788647@sss.pgh.pa.us> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/286 +X-Sequence-Number: 13527 + + + +> total. If the insertion pattern is sufficiently random that the entire +> index ranges are "hot" then you might not have enough RAM. + + Try doing the test dropping some of your indexes and see if it moves the +number of iterations after which it becomes slow. + +From pgsql-performance-owner@postgresql.org Tue Jul 19 13:31:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DDD6A5286E + for ; + Tue, 19 Jul 2005 13:31:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69752-06 + for ; + Tue, 19 Jul 2005 16:31:12 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) + by svr1.postgresql.org (Postfix) with ESMTP id 1EFD252863 + for ; + Tue, 19 Jul 2005 13:31:11 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i30so1231264wra + for ; + Tue, 19 Jul 2005 09:31:11 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=CWJYJxlPFuk4Op/Sb2huDRFLcWSy3R/qSOEDpjXN8nd36we9UVcz7B3A2yUFfqAC8tkzkw88Kf9zBB/2uP+FeVMgKA9fqg+u+0e1NtlXLQ223IEI6kvk41umauiW2JZYr9p92tbvTXtwUcCkBlFPm16SuuD1GJiNACpCL8IGtYQ= +Received: by 10.54.36.32 with SMTP id j32mr788866wrj; + Tue, 19 Jul 2005 09:30:34 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Tue, 19 Jul 2005 09:30:34 -0700 (PDT) +Message-ID: <59d991c40507190930244ba9bb@mail.gmail.com> +Date: Tue, 19 Jul 2005 12:30:34 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Impact of checkpoint_segments under continual load conditions +Cc: PFC , Vivek Khera , + pgsql-performance@postgresql.org +In-Reply-To: <4541.1121788647@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: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> + + <59d991c4050719084460b376f1@mail.gmail.com> + <4541.1121788647@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.158 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/287 +X-Sequence-Number: 13528 + +On 7/19/05, Tom Lane wrote: +> Christopher Petrilli writes:=20 +> > Not sure... my benchmark is designed to represent what the database +> > will do under "typical" circumstances, and unfortunately these are +> > typical for the application. However, I can see about adding some +> > delays, though multiple minutes would be absurd in the application. +> > Perhaps a 5-10 second day? Would that still be interesting? +>=20 +> I think PFC's question was not directed towards modeling your +> application, but about helping us understand what is going wrong +> (so we can fix it). It seemed like a good idea to me. + +OK, I can modify the code to do that, and I will post it on the web. + +> The startup transient probably corresponds to the extra I/O needed to +> repopulate shared buffers with a useful subset of your indexes. But +> just to be perfectly clear: you tried this, and after the startup +> transient it returned to the *original* trend line? In particular, +> the performance goes into the tank after about 5000 total iterations, +> and not 5000 iterations after the postmaster restart? + +This is correct, the TOTAL is what matters, not the specific instance +count. I did an earlier run with larger batch sizes, and it hit at a +similar row count, so it's definately row-count/size related. +=20 +> I'm suddenly wondering if the performance dropoff corresponds to the +> point where the indexes have grown large enough to not fit in shared +> buffers anymore. If I understand correctly, the 5000-iterations mark +> corresponds to 2.5 million total rows in the table; with 5 indexes +> you'd have 12.5 million index entries or probably a couple hundred MB +> total. If the insertion pattern is sufficiently random that the entire +> index ranges are "hot" then you might not have enough RAM. + +This is entirely possible, currently: + +shared_buffers =3D 1000 =20 +work_mem =3D 65535 =20 +maintenance_work_mem =3D 16384 =20 +max_stack_depth =3D 2048 =20 + +> Again, experimenting with different values of shared_buffers seems like +> a very worthwhile thing to do. + +I miss-understood shared_buffers then, as I thought work_mem was where +indexes were kept. If this is where index manipulations happen, then +I can up it quite a bit. The machine this is running on has 2GB of +RAM. + +My concern isn't absolute performance, as this is not representative +hardware, but instead is the evenness of behavior. + +Chris +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Jul 19 13:35:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7CB9952833 + for ; + Tue, 19 Jul 2005 13:35:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 72426-03 + for ; + Tue, 19 Jul 2005 16:35:21 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) + by svr1.postgresql.org (Postfix) with ESMTP id 90594529AE + for ; + Tue, 19 Jul 2005 13:35:18 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i20so1231315wra + for ; + Tue, 19 Jul 2005 09:35:19 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=j1fUZ2Fbhmw5a4OFVS9N0HNEW6PVkP1paho8PC8yM+6Zs93ud87u1a5PgcaqKoyNxdhdCJO8+BhA4x2GDuvy1wETM3pKznnXCWS0Ph2sBpHNNpcsGvS7XtvXCmcEW/PuLknMjs6lzREadApRlTv/IrCF3an8rKnaKe62x1QqcKM= +Received: by 10.54.68.4 with SMTP id q4mr791998wra; + Tue, 19 Jul 2005 09:34:19 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Tue, 19 Jul 2005 09:34:19 -0700 (PDT) +Message-ID: <59d991c405071909341a10143@mail.gmail.com> +Date: Tue, 19 Jul 2005 12:34:19 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: PFC +Subject: Re: Impact of checkpoint_segments under continual load conditions +Cc: Tom Lane , Vivek Khera , + 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: <59d991c4050717100874c08a86@mail.gmail.com> + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> + + <59d991c4050719084460b376f1@mail.gmail.com> + <4541.1121788647@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.155 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/288 +X-Sequence-Number: 13529 + +On 7/19/05, PFC wrote: +>=20 +>=20 +> > I think PFC's question was not directed towards modeling your +> > application, but about helping us understand what is going wrong +> > (so we can fix it). +>=20 +> Exactly, I was wondering if this delay would allow things to get = +flushed, +> for instance, which would give information about the problem (if giving i= +t +> a few minutes of rest resumed normal operation, it would mean that some +> buffer somewhere is getting filled faster than it can be flushed). +>=20 +> So, go ahead with a few minutes even if it's unrealistic, that is= + not the +> point, you have to tweak it in various possible manners to understand the +> causes. + +Totally understand, and appologize if I sounded dismissive. I +definately appreciate the insight and input. +=20 +> And instead of a pause, why not just set the duration of your tes= +t to +> 6000 iterations and run it two times without dropping the test table ? + +This I can do. I'll probably set it for 5,000 for the first, and +then start the second. In non-benchmark experience, however, this +didn't seem to make much difference. + +> I'm going into wild guesses, but first you should want to know if= + the +> problem is because the table is big, or if it's something else. So you ru= +n +> the complete test, stopping a bit after it starts to make a mess, then +> instead of dumping the table and restarting the test anew, you leave it a= +s +> it is, do something, then run a new test, but on this table which already +> has data. +>=20 +> 'something' could be one of those : +> disconnect, reconnect (well you'll have to do that if you run the= + test +> twice anyway) +> just wait +> restart postgres +> unmount and remount the volume with the logs/data on it +> reboot the machine +> analyze +> vacuum +> vacuum analyze +> cluster +> vacuum full +> reindex +> defrag your files on disk (stopping postgres and copying the data= +base +> from your disk to anotherone and back will do) +> or even dump'n'reload the whole database +>=20 +> I think useful information can be extracted that way. If one of t= +hese +> fixes your problem it'l give hints. +>=20 + +This could take a while :-) + +Chris +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Jul 19 13:42:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3645952833 + for ; + Tue, 19 Jul 2005 13:42:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74392-01 + for ; + Tue, 19 Jul 2005 16:42:20 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C59615284F + for ; + Tue, 19 Jul 2005 13:42:18 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6JGg8qj007225; + Tue, 19 Jul 2005 12:42:08 -0400 (EDT) +To: Christopher Petrilli +Cc: PFC , Vivek Khera , + pgsql-performance@postgresql.org +Subject: Re: Impact of checkpoint_segments under continual load conditions +In-reply-to: <59d991c40507190930244ba9bb@mail.gmail.com> +References: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> + + <59d991c4050719084460b376f1@mail.gmail.com> + <4541.1121788647@sss.pgh.pa.us> + <59d991c40507190930244ba9bb@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Tue, 19 Jul 2005 12:30:34 -0400" +Date: Tue, 19 Jul 2005 12:42:08 -0400 +Message-ID: <7224.1121791328@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/289 +X-Sequence-Number: 13530 + +Christopher Petrilli writes: +> On 7/19/05, Tom Lane wrote: +>> I'm suddenly wondering if the performance dropoff corresponds to the +>> point where the indexes have grown large enough to not fit in shared +>> buffers anymore. If I understand correctly, the 5000-iterations mark +>> corresponds to 2.5 million total rows in the table; with 5 indexes +>> you'd have 12.5 million index entries or probably a couple hundred MB +>> total. If the insertion pattern is sufficiently random that the entire +>> index ranges are "hot" then you might not have enough RAM. + +> This is entirely possible, currently: + +> shared_buffers = 1000 + +Ah-hah --- with that setting, you could be seeing shared-buffer +thrashing even if only a fraction of the total index ranges need to be +touched. I'd try some runs with shared_buffers at 10000, 50000, 100000. + +You might also try strace'ing the backend and see if behavior changes +noticeably when the performance tanks. + +FWIW I have seen similar behavior while playing with MySQL's sql-bench +test --- the default 1000 shared_buffers is not large enough to hold +the "hot" part of the indexes in some of their insertion tests, and so +performance tanks --- you can see this happening in strace because the +kernel request mix goes from almost all writes to a significant part +reads. On a pure data insertion benchmark you'd like to see nothing +but writes. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jul 19 13:50:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0E5E352A3A + for ; + Tue, 19 Jul 2005 13:50:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74720-04 + for ; + Tue, 19 Jul 2005 16:50:26 +0000 (GMT) +Received: from sherman.stortek.com (sherman.stortek.com [129.80.22.146]) + by svr1.postgresql.org (Postfix) with ESMTP id D189752A1B + for ; + Tue, 19 Jul 2005 13:50:18 -0300 (ADT) +Received: from sherman.stortek.com (localhost [127.0.0.1]) + by sherman.stortek.com (8.12.10/8.12.0) with ESMTP id j6JGoHD4003067 + for ; + Tue, 19 Jul 2005 10:50:17 -0600 (MDT) +Received: from unix.stortek.com (burma.stortek.com [129.80.16.110]) + by sherman.stortek.com (8.12.10/8.12.0) with ESMTP id j6JGoGDC003064; + Tue, 19 Jul 2005 10:50:16 -0600 (MDT) +Received: from C118181.stortek.com (c118181.stortek.com [129.80.81.172]) + by unix.stortek.com (8.12.10/8.12.0) with ESMTP id j6JGoFvn025709; + Tue, 19 Jul 2005 10:50:16 -0600 (MDT) +Date: Tue, 19 Jul 2005 10:50:14 -0600 +From: Robert Creager +To: Tom Lane +Cc: pgsql-performance@postgresql.org +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS issue? +Message-ID: <20050719105014.00007635@C118181.stortek.com> +In-Reply-To: <15472.1121709173@sss.pgh.pa.us> +References: <20050718114952.00004ac5@C118181.stortek.com> + <15472.1121709173@sss.pgh.pa.us> +Organization: StorageTek +X-Mailer: Sylpheed-Claws 1.0.4.1 Win32 (GTK+ 1.3.0; Win32) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/290 +X-Sequence-Number: 13531 + +On Mon, 18 Jul 2005 13:52:53 -0400 +Tom Lane wrote: + +> +> Start a fresh psql session and "SHOW vacuum_cost_delay" to verify what +> the active setting is. +> + +Alright. Restarted the 803 database. Cron based vacuum analyze is running +every 5 minutes. vacuum_cost_delay is 0. The problem showed up after about 1/2 +hour of running. I've got vacuum jobs stacked from the last 35 minutes, with 2 +vacuums running at the same time. CS is around 73k. + +What do I do now? I can bring the db back to normal and not run any cron based +vacuum to see if it still happens, but I suspect nothing will happen without the +vacuum. I'll leave it in it's current semi-catatonic state as long as possible +in case there is something to look at? + +Cheers, +Rob + +From pgsql-performance-owner@postgresql.org Tue Jul 19 13:54:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A8FF552A51 + for ; + Tue, 19 Jul 2005 13:54:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73382-10 + for ; + Tue, 19 Jul 2005 16:54:23 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6FB8E52A36 + for ; + Tue, 19 Jul 2005 13:54:22 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6JGsMkD007323; + Tue, 19 Jul 2005 12:54:22 -0400 (EDT) +To: Robert Creager +Cc: pgsql-performance@postgresql.org +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS issue? +In-reply-to: <20050719105014.00007635@C118181.stortek.com> +References: <20050718114952.00004ac5@C118181.stortek.com> + <15472.1121709173@sss.pgh.pa.us> + <20050719105014.00007635@C118181.stortek.com> +Comments: In-reply-to Robert Creager + message dated "Tue, 19 Jul 2005 10:50:14 -0600" +Date: Tue, 19 Jul 2005 12:54:22 -0400 +Message-ID: <7322.1121792062@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/291 +X-Sequence-Number: 13532 + +Robert Creager writes: +> Alright. Restarted the 803 database. Cron based vacuum analyze is +> running every 5 minutes. vacuum_cost_delay is 0. The problem showed +> up after about 1/2 hour of running. I've got vacuum jobs stacked from +> the last 35 minutes, with 2 vacuums running at the same time. CS is +> around 73k. + +Hmm, I hadn't thought about the possible impact of multiple concurrent +vacuums. Is the problem caused by that, or has performance already gone +into the tank by the time the cron-driven vacuums are taking long enough +to overlap? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jul 19 13:55:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AB82552992 + for ; + Tue, 19 Jul 2005 13:55:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74392-06 + for ; + Tue, 19 Jul 2005 16:55:37 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.203]) + by svr1.postgresql.org (Postfix) with ESMTP id BD17652988 + for ; + Tue, 19 Jul 2005 13:55:36 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 50so385440wri + for ; + Tue, 19 Jul 2005 09:55:36 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=KWFv+gVJIe573uxo5XQb/weA2zAVI7YRaQ1bXSx6rD4E0OSMBAMRfZ1pkhJadaLIpJiPy7T0FsGVLx4l1dbC9YgkeZCFc6e5S/rBBKzQu+R/WucZu4bkIxaWBu1S+OzKFA070PwF5R9o4fNu85Dvqqooyhf/aqTJiCaI9yJo86Q= +Received: by 10.54.36.59 with SMTP id j59mr799612wrj; + Tue, 19 Jul 2005 09:54:35 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Tue, 19 Jul 2005 09:54:35 -0700 (PDT) +Message-ID: <59d991c4050719095440cd3de5@mail.gmail.com> +Date: Tue, 19 Jul 2005 12:54:35 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Impact of checkpoint_segments under continual load conditions +Cc: PFC , Vivek Khera , + pgsql-performance@postgresql.org +In-Reply-To: <7224.1121791328@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: <59d991c4050717100874c08a86@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> + + <59d991c4050719084460b376f1@mail.gmail.com> + <4541.1121788647@sss.pgh.pa.us> + <59d991c40507190930244ba9bb@mail.gmail.com> + <7224.1121791328@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.153 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/292 +X-Sequence-Number: 13533 + +As I'm doing this, I'm noticing something *VERY* disturbing to me: + +postmaster backend: 20.3% CPU +psql frontend: 61.2% CPU + +WTF? The only thing going through the front end is the COPY command, +and it's sent to the backend to read from a file? + +Chris +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Jul 19 14:05:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9E9DD52A2D + for ; + Tue, 19 Jul 2005 14:05:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91881-05 + for ; + Tue, 19 Jul 2005 17:05:31 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 289BA52863 + for ; + Tue, 19 Jul 2005 14:05:29 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6JH5PS6007437; + Tue, 19 Jul 2005 13:05:25 -0400 (EDT) +To: Christopher Petrilli +Cc: PFC , Vivek Khera , + pgsql-performance@postgresql.org +Subject: Re: Impact of checkpoint_segments under continual load conditions +In-reply-to: <59d991c4050719095440cd3de5@mail.gmail.com> +References: <59d991c4050717100874c08a86@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> + + <59d991c4050719084460b376f1@mail.gmail.com> + <4541.1121788647@sss.pgh.pa.us> + <59d991c40507190930244ba9bb@mail.gmail.com> + <7224.1121791328@sss.pgh.pa.us> + <59d991c4050719095440cd3de5@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Tue, 19 Jul 2005 12:54:35 -0400" +Date: Tue, 19 Jul 2005 13:05:25 -0400 +Message-ID: <7436.1121792725@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/293 +X-Sequence-Number: 13534 + +Christopher Petrilli writes: +> As I'm doing this, I'm noticing something *VERY* disturbing to me: +> postmaster backend: 20.3% CPU +> psql frontend: 61.2% CPU + +> WTF? The only thing going through the front end is the COPY command, +> and it's sent to the backend to read from a file? + +Are you sure the backend is reading directly from the file, and not +through psql? (\copy, or COPY FROM STDIN, would go through psql.) + +But even so that seems awfully high, considering how little work psql +has to do compared to the backend. Has anyone ever profiled psql doing +this sort of thing? I know I've spent all my time looking at the +backend ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jul 19 14:14:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 189F0528C3 + for ; + Tue, 19 Jul 2005 14:14:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89409-09 + for ; + Tue, 19 Jul 2005 17:14:03 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) + by svr1.postgresql.org (Postfix) with ESMTP id E60D352863 + for ; + Tue, 19 Jul 2005 14:13:59 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i28so1240542wra + for ; + Tue, 19 Jul 2005 10:14:00 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=RK6fYl2KXT+VFBt9MqGccMbt3z5NFXUzchXFqXnIx2SwhFbAtAIvIQxg5Fxqag2Xtn2wzWQGNcY99rigGZWdXZFLcUjCYvm+wwgwkOPfl/zrflCe9Hi6cRm1gMoH/Z1wX2bxtSQBEpPvLavzoXOfoMFsy/HlLk6wWZNMJQpN2yg= +Received: by 10.54.37.71 with SMTP id k71mr804351wrk; + Tue, 19 Jul 2005 10:13:05 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Tue, 19 Jul 2005 10:13:05 -0700 (PDT) +Message-ID: <59d991c405071910133e28031a@mail.gmail.com> +Date: Tue, 19 Jul 2005 13:13:05 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Impact of checkpoint_segments under continual load conditions +Cc: PFC , Vivek Khera , + pgsql-performance@postgresql.org +In-Reply-To: <7436.1121792725@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: <59d991c4050717100874c08a86@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> + + <59d991c4050719084460b376f1@mail.gmail.com> + <4541.1121788647@sss.pgh.pa.us> + <59d991c40507190930244ba9bb@mail.gmail.com> + <7224.1121791328@sss.pgh.pa.us> + <59d991c4050719095440cd3de5@mail.gmail.com> + <7436.1121792725@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.15 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/294 +X-Sequence-Number: 13535 + +On 7/19/05, Tom Lane wrote: +> Christopher Petrilli writes: +> > As I'm doing this, I'm noticing something *VERY* disturbing to me: +> > postmaster backend: 20.3% CPU +> > psql frontend: 61.2% CPU +>=20 +> > WTF? The only thing going through the front end is the COPY command, +> > and it's sent to the backend to read from a file? +>=20 +> Are you sure the backend is reading directly from the file, and not +> through psql? (\copy, or COPY FROM STDIN, would go through psql.) + +The exact command is: + +COPY test (columnlist...) FROM '/tmp/loadfile'; +=20 +> But even so that seems awfully high, considering how little work psql +> has to do compared to the backend. Has anyone ever profiled psql doing +> this sort of thing? I know I've spent all my time looking at the +> backend ... + +Linux 2.6, ext3, data=3Dwriteback + +It's flipped now (stil lrunning), and it's 48% postmaster, 36% psql, +but anything more than 1-2% seems absurd. + +Chris +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Jul 19 14:43:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 59A7A52990 + for ; + Tue, 19 Jul 2005 14:43:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23853-03 + for ; + Tue, 19 Jul 2005 17:43:27 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) + by svr1.postgresql.org (Postfix) with ESMTP id C65FF5284F + for ; + Tue, 19 Jul 2005 14:43:23 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i14so1270743wra + for ; + Tue, 19 Jul 2005 10:43:24 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; + b=cwrfNIfIFDBf8f+uGSSB+iubc258lk7Tr2ktj+IKTy9PdkvWSegzeOYp4+UKLFqCQ1HWQOOLMQ8AnGefND3l972LEgJGb3yb/kI6iJCLGA+Cye+5JynODMH/B4l6j2IFEM7UauhdHtPP3gZcyWCfnUqS1uiAf17Mkh+4fKQOucE= +Received: by 10.54.44.53 with SMTP id r53mr823205wrr; + Tue, 19 Jul 2005 10:42:42 -0700 (PDT) +Received: by 10.54.150.2 with HTTP; Tue, 19 Jul 2005 10:42:41 -0700 (PDT) +Message-ID: <1efd553a05071910427b290203@mail.gmail.com> +Date: Tue, 19 Jul 2005 13:42:42 -0400 +From: Oliver Crosby +Reply-To: Oliver Crosby +To: pgsql-performance@postgresql.org +Subject: Looking for tips +Mime-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_3181_11694449.1121794962010" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.32 tagged_above=0 required=5 tests=HTML_10_20, + HTML_MESSAGE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/295 +X-Sequence-Number: 13536 + +------=_Part_3181_11694449.1121794962010 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +Hi, +I'm running Postgres 7.4.6 on a dedicated server with about 1.5gigs of ram. +Running scripts locally, it takes about 1.5x longer than mysql, and the loa= +d=20 +on the server is only about 21%. +I upped the sort_mem to 8192 (kB), and shared_buffers and=20 +effective_cache_size to 65536 (512MB), but neither the timing nor the serve= +r=20 +load have changed at all. FYI, I'm going to be working on data sets in the= +=20 +order of GB. + I think I've gone about as far as I can with google.. can anybody give me= +=20 +some advice on how to improve the raw performance before I start looking at= +=20 +code changes? + Thanks in advance. + +------=_Part_3181_11694449.1121794962010 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +
Hi,
+
I'm running Postgres 7.4.6 on a dedicated server with about 1.5gigs of= + ram.
+
Running scripts locally, it takes about 1.5x longer than mysql, and th= +e load on the server is only about 21%.
+
I upped the sort_mem to 8192 (kB), and shared_buffers and effective_ca= +che_size to 65536 (512MB), but neither the timing nor the server load have = +changed at all. FYI, I'm going to be working on data sets in the order of G= +B. +
+
 
+
I think I've gone about as far as I can with google.. can anybody give= + me some advice on how to improve the raw performance before I start lookin= +g at code changes?
+
 
+
Thanks in advance.
+ +------=_Part_3181_11694449.1121794962010-- + +From pgsql-performance-owner@postgresql.org Tue Jul 19 14:50:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9374552932 + for ; + Tue, 19 Jul 2005 14:50:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31735-03 + for ; + Tue, 19 Jul 2005 17:50:16 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 122155284F + for ; + Tue, 19 Jul 2005 14:50:15 -0300 (ADT) +Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j6JHoDhr028623; Tue, 19 Jul 2005 10:50:13 -0700 +Message-ID: <42DD3D55.9020508@commandprompt.com> +Date: Tue, 19 Jul 2005 10:50:13 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Oliver Crosby +Cc: pgsql-performance@postgresql.org +Subject: Re: Looking for tips +References: <1efd553a05071910427b290203@mail.gmail.com> +In-Reply-To: <1efd553a05071910427b290203@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/296 +X-Sequence-Number: 13537 + +Oliver Crosby wrote: +> Hi, +> I'm running Postgres 7.4.6 on a dedicated server with about 1.5gigs of ram. +> Running scripts locally, it takes about 1.5x longer than mysql, and the +> load on the server is only about 21%. + +What queries? +What is your structure? +Have you tried explain analyze? +How many rows in the table? +Which OS? +How are you testing the speed? +What type of RAID? + + + +-- +Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 +PostgreSQL Replication, Consulting, Custom Programming, 24x7 support +Managed Services, Shared and Dedicated Hosting +Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ + +From pgsql-performance-owner@postgresql.org Tue Jul 19 14:58:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 497E752808 + for ; + Tue, 19 Jul 2005 14:58:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36412-04 + for ; + Tue, 19 Jul 2005 17:58:46 +0000 (GMT) +Received: from ionian.i-clic.uihc.uiowa.edu (ionian.i-clic.uihc.uiowa.edu + [129.255.211.20]) + by svr1.postgresql.org (Postfix) with ESMTP id 639D352A1F + for ; + Tue, 19 Jul 2005 14:58:43 -0300 (ADT) +Received: by ionian.i-clic.uihc.uiowa.edu (Postfix, from userid 76) + id 1850661DB0; Tue, 19 Jul 2005 11:51:04 -0500 (CDT) +Received: from [192.168.1.11] (12-214-18-81.client.mchsi.com [12.214.18.81]) + by ionian.i-clic.uihc.uiowa.edu (Postfix) with ESMTP + id C3DC061DAF; Tue, 19 Jul 2005 11:51:02 -0500 (CDT) +Message-ID: <42DD3F3C.7000502@arbash-meinel.com> +Date: Tue, 19 Jul 2005 12:58:20 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Oliver Crosby +Cc: pgsql-performance@postgresql.org +Subject: Re: Looking for tips +References: <1efd553a05071910427b290203@mail.gmail.com> +In-Reply-To: <1efd553a05071910427b290203@mail.gmail.com> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigCB437C5FBC85BBD7FF02B6D1" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.021 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/297 +X-Sequence-Number: 13538 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigCB437C5FBC85BBD7FF02B6D1 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Oliver Crosby wrote: +> Hi, +> I'm running Postgres 7.4.6 on a dedicated server with about 1.5gigs of ram. +> Running scripts locally, it takes about 1.5x longer than mysql, and the +> load on the server is only about 21%. +> I upped the sort_mem to 8192 (kB), and shared_buffers and +> effective_cache_size to 65536 (512MB), but neither the timing nor the +> server load have changed at all. FYI, I'm going to be working on data +> sets in the order of GB. +> +> I think I've gone about as far as I can with google.. can anybody give +> me some advice on how to improve the raw performance before I start +> looking at code changes? +> +> Thanks in advance. + +First, try to post in plain-text rather than html, it is easier to read. :) + +Second, if you can determine what queries are running slow, post the +result of EXPLAIN ANALYZE on them, and we can try to help you tune +them/postgres to better effect. + +Just a blanket question like this is hard to answer. Your new +shared_buffers are probably *way* too high. They should be at most +around 10% of ram. Since this is a dedicated server effective_cache_size +should be probably ~75% of ram, or close to 1.2GB. + +There are quite a few things that you can tweak, so the more information +you can give, the more we can help. + +For instance, if you are loading a lot of data into a table, if +possible, you want to use COPY not INSERT. +If you have a lot of indexes and are loading a significant portion, it +is sometimes faster to drop the indexes, COPY the data in, and then +rebuild the indexes. + +For tables with a lot of inserts/updates, you need to watch out for +foreign key constraints. (Generally, you will want an index on both +sides of the foreign key. One is required, the other is recommended for +faster update/deletes). + +John +=:-> + + +--------------enigCB437C5FBC85BBD7FF02B6D1 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC3T9AJdeBCYSNAAMRAp+FAKDRs5s7EatjgMvPMJRl5VVzbb24XwCdGCVV +HqKtYtqNvXBExk7Jv7MYFF8= +=/XjI +-----END PGP SIGNATURE----- + +--------------enigCB437C5FBC85BBD7FF02B6D1-- + +From pgsql-performance-owner@postgresql.org Tue Jul 19 15:10:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BD93F52932 + for ; + Tue, 19 Jul 2005 15:10:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42519-03 + for ; + Tue, 19 Jul 2005 18:09:53 +0000 (GMT) +Received: from sherman.stortek.com (sherman.stortek.com [129.80.22.146]) + by svr1.postgresql.org (Postfix) with ESMTP id 7E5645284F + for ; + Tue, 19 Jul 2005 15:09:52 -0300 (ADT) +Received: from sherman.stortek.com (localhost [127.0.0.1]) + by sherman.stortek.com (8.12.10/8.12.0) with ESMTP id j6JI9rD4000814 + for ; + Tue, 19 Jul 2005 12:09:53 -0600 (MDT) +Received: from unix.stortek.com (burma.stortek.com [129.80.16.110]) + by sherman.stortek.com (8.12.10/8.12.0) with ESMTP id j6JI9qDC000810; + Tue, 19 Jul 2005 12:09:53 -0600 (MDT) +Received: from C118181.stortek.com (c118181.stortek.com [129.80.81.172]) + by unix.stortek.com (8.12.10/8.12.0) with ESMTP id j6JI9pvn028181; + Tue, 19 Jul 2005 12:09:52 -0600 (MDT) +Date: Tue, 19 Jul 2005 12:09:51 -0600 +From: Robert Creager +To: Tom Lane +Cc: Robert Creager , + pgsql-performance@postgresql.org, + Andy Hewitt III +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS issue? +Message-ID: <20050719120951.00002520@C118181.stortek.com> +In-Reply-To: <7322.1121792062@sss.pgh.pa.us> +References: <20050718114952.00004ac5@C118181.stortek.com> + <15472.1121709173@sss.pgh.pa.us> + <20050719105014.00007635@C118181.stortek.com> + <7322.1121792062@sss.pgh.pa.us> +Organization: StorageTek +X-Mailer: Sylpheed-Claws 1.0.4.1 Win32 (GTK+ 1.3.0; Win32) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/298 +X-Sequence-Number: 13539 + +On Tue, 19 Jul 2005 12:54:22 -0400 +Tom Lane wrote: + +> Hmm, I hadn't thought about the possible impact of multiple concurrent +> vacuums. Is the problem caused by that, or has performance already gone +> into the tank by the time the cron-driven vacuums are taking long enough +> to overlap? + +Don't know just yet. When I run the vacuums manually on a healthy system on +741, they take less than 30 seconds. I've stopped the cron vacuum and canceled +all the outstanding vacuum processes, but the 803 is still struggling (1/2 hour +later). + +I'll re-start the database, vacuum full analyze and restart the runs without the +cron vacuum running. + +Cheers, +Rob + +From pgsql-performance-owner@postgresql.org Tue Jul 19 15:10:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7EF5B52988 + for ; + Tue, 19 Jul 2005 15:10:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42519-04 + for ; + Tue, 19 Jul 2005 18:10:08 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id ED5565298F + for ; + Tue, 19 Jul 2005 15:10:04 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6JI9ueC007844; + Tue, 19 Jul 2005 14:09:56 -0400 (EDT) +To: Christopher Petrilli +Cc: PFC , Vivek Khera , + pgsql-performance@postgresql.org +Subject: Re: Impact of checkpoint_segments under continual load conditions +In-reply-to: <59d991c405071910133e28031a@mail.gmail.com> +References: <59d991c4050717100874c08a86@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> + + <59d991c4050719084460b376f1@mail.gmail.com> + <4541.1121788647@sss.pgh.pa.us> + <59d991c40507190930244ba9bb@mail.gmail.com> + <7224.1121791328@sss.pgh.pa.us> + <59d991c4050719095440cd3de5@mail.gmail.com> + <7436.1121792725@sss.pgh.pa.us> + <59d991c405071910133e28031a@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Tue, 19 Jul 2005 13:13:05 -0400" +Date: Tue, 19 Jul 2005 14:09:56 -0400 +Message-ID: <7843.1121796596@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/299 +X-Sequence-Number: 13540 + +Christopher Petrilli writes: +>> Are you sure the backend is reading directly from the file, and not +>> through psql? (\copy, or COPY FROM STDIN, would go through psql.) + +> The exact command is: +> COPY test (columnlist...) FROM '/tmp/loadfile'; + +I tried to replicate this by putting a ton of COPY commands like that +into a file and doing "psql -f file ...". I don't see more than about +0.3% CPU going to psql. So there's something funny about your test +conditions. How *exactly* are you invoking psql? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jul 19 15:15:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3025E5293E + for ; + Tue, 19 Jul 2005 15:15:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48005-07 + for ; + Tue, 19 Jul 2005 18:15:31 +0000 (GMT) +Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) + by svr1.postgresql.org (Postfix) with ESMTP id 601DD52AAB + for ; + Tue, 19 Jul 2005 15:15:30 -0300 (ADT) +Received: from mainbox.archonet.com + (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) + by smtp.metronet.co.uk (MetroNet Mail) with ESMTP + id A860940C972; Tue, 19 Jul 2005 19:15:16 +0100 (BST) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP id F019B15EE6; + Tue, 19 Jul 2005 19:10:24 +0100 (BST) +Received: from mainbox.archonet.com ([127.0.0.1]) + by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 13801-04; Tue, 19 Jul 2005 19:10:20 +0100 (BST) +Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP id 68C6715EE1; + Tue, 19 Jul 2005 19:10:20 +0100 (BST) +Message-ID: <42DD420C.2010306@archonet.com> +Date: Tue, 19 Jul 2005 19:10:20 +0100 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Oliver Crosby +Cc: pgsql-performance@postgresql.org +Subject: Re: Looking for tips +References: <1efd553a05071910427b290203@mail.gmail.com> +In-Reply-To: <1efd553a05071910427b290203@mail.gmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/300 +X-Sequence-Number: 13541 + +Oliver Crosby wrote: +> Hi, +> I'm running Postgres 7.4.6 on a dedicated server with about 1.5gigs of ram. +> Running scripts locally, it takes about 1.5x longer than mysql, and the load +> on the server is only about 21%. + +What scripts? What do they do? +Oh, and 7.4.8 is the latest release - worth upgrading for the fixes. + +> I upped the sort_mem to 8192 (kB), and shared_buffers and +> effective_cache_size to 65536 (512MB), but neither the timing nor the server +> load have changed at all. + +Well, effective_cache_size is the amount of RAM being used by the OS to +cache your files, so take a look at top/free and set it based on that +(pick a steady load). + +What sort_mem should be will obviously depend how much sorting you do. + +Drop shared_buffers down to about 10000 - 20000 (at a guess) + +You may find the following useful + http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php +Read the Performance Tuning article, there is an updated one for version +8 at: + http://www.powerpostgresql.com/PerfList + + > FYI, I'm going to be working on data sets in the +> order of GB. + +Fair enough. + +> I think I've gone about as far as I can with google.. can anybody give me +> some advice on how to improve the raw performance before I start looking at +> code changes? + +Identify what the problem is first of all. Some things to consider: + - Are there particular queries giving you trouble? + - Is your load mostly reads or mostly writes? + - Do you have one user or 100? + - Are you block-loading data efficiently where necessary? + - Have you indexed both sides of your foreign-keys where sensible? + - Are your disks being used effectively? + - Are your statistics accurate/up to date? + +Bear in mind that MySQL will probably be quicker for simple queries for +one user and always will be. If you have multiple users running a mix of +multi-table joins and updates then PG will have a chance to stretch its +legs. + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Tue Jul 19 15:22:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 16CE45284F + for ; + Tue, 19 Jul 2005 15:22:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48325-07 + for ; + Tue, 19 Jul 2005 18:22:03 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) + by svr1.postgresql.org (Postfix) with ESMTP id 502F952988 + for ; + Tue, 19 Jul 2005 15:22:02 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i16so1276478wra + for ; + Tue, 19 Jul 2005 11:22:03 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=odu9+kMy++RLL6JzTEn9RNHJvOqav/qQSorz3esHO1HOnm81YSZ6elDsHf+qgHNjbiRBwX+aIgCOnVYMnSlboz2gebK46HGWPyUJQwlU/lly4o/4syzAK4egb2oKAjS83gujv7/Xi/IGTCABU1/Nkuz9D6BKMU2603tztqRDP/Y= +Received: by 10.54.109.20 with SMTP id h20mr837828wrc; + Tue, 19 Jul 2005 11:21:22 -0700 (PDT) +Received: by 10.54.150.2 with HTTP; Tue, 19 Jul 2005 11:21:22 -0700 (PDT) +Message-ID: <1efd553a050719112126b8d981@mail.gmail.com> +Date: Tue, 19 Jul 2005 14:21:22 -0400 +From: Oliver Crosby +Reply-To: Oliver Crosby +To: "Joshua D. Drake" +Subject: Re: Looking for tips +Cc: pgsql-performance@postgresql.org +In-Reply-To: <42DD3D55.9020508@commandprompt.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <1efd553a05071910427b290203@mail.gmail.com> + <42DD3D55.9020508@commandprompt.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.172 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/301 +X-Sequence-Number: 13542 + +I was hoping to start with tuning postgres to match the hardware, but +in any case.. + +The queries are all simple insert or select statements on single tables. +Eg. select x from table where y=3D?; or insert into table (a, b, c) +values (?, ?, ?); +In the case of selects where it's a large table, there's an index on +the column being searched, so in terms of the example above, x is +either a pkey column or other related field, and y is a non-pkey +column. + +I'm not sure what you mean by structure. + +I tried explain analyse on the individual queries, but I'm not sure +what can be done to manipulate them when they don't do much. + +My test environment has about 100k - 300k rows in each table, and for +production I'm expecting this to be in the order of 1M+. + +The OS is Redhat Enterprise 3. + +I'm using a time command when I call the scripts to get a total +running time from start to finish. + +I don't know what we have for RAID, but I suspect it's just a single +10k or 15k rpm hdd. +---------------------------------------------------------------------------= +--------------------------------------------- +I'll try your recommendations for shared_buffers and +effective_cache_size. Thanks John! + +We're trying to improve performance on a log processing script to the +point where it can be run as close as possible to realtime. A lot of +what gets inserted depends on what's already in the db, and it runs +item-by-item... so unfortunately I can't take advantage of copy. + +We tried dropping indices, copying data in, then rebuilding. It works +great for a bulk import, but the processing script went a lot slower +without them. (Each insert is preceeded by a local cache check and +then a db search to see if an ID already exists for an item.) + +We have no foreign keys at the moment. Would they help? + + +On 7/19/05, Joshua D. Drake wrote: +> Oliver Crosby wrote: +> > Hi, +> > I'm running Postgres 7.4.6 on a dedicated server with about 1.5gigs of = +ram. +> > Running scripts locally, it takes about 1.5x longer than mysql, and the +> > load on the server is only about 21%. +>=20 +> What queries? +> What is your structure? +> Have you tried explain analyze? +> How many rows in the table? +> Which OS? +> How are you testing the speed? +> What type of RAID? +>=20 +>=20 +>=20 +> -- +> Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 +> PostgreSQL Replication, Consulting, Custom Programming, 24x7 support +> Managed Services, Shared and Dedicated Hosting +> Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ +> + +From pgsql-performance-owner@postgresql.org Tue Jul 19 15:23:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 55EE852A38 + for ; + Tue, 19 Jul 2005 15:23:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52942-08 + for ; + Tue, 19 Jul 2005 18:23:27 +0000 (GMT) +Received: from cdrsmtp01.yellowbook.com (unknown [64.199.226.83]) + by svr1.postgresql.org (Postfix) with ESMTP id 8A62352A90 + for ; + Tue, 19 Jul 2005 15:23:24 -0300 (ADT) +Received: from ybcdrmta01.corp.ybusa.net ([10.5.17.170]) by + cdrsmtp01.yellowbook.com with Microsoft SMTPSVC(6.0.3790.0); + Tue, 19 Jul 2005 13:26:40 -0500 +Received: from YBCDREX01.corp.ybusa.net ([10.5.17.162]) by + ybcdrmta01.corp.ybusa.net with Microsoft SMTPSVC(6.0.3790.211); + Tue, 19 Jul 2005 13:23:25 -0500 +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C58C8E.F3B5F894" +Subject: context-switching issue on Xeon +Date: Tue, 19 Jul 2005 13:23:25 -0500 +Message-ID: <3FB3AAE149F4AD4D8499E15EE8CF41A3460442@YBCDREX01.corp.ybusa.net> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: context-switching issue on Xeon +Thread-Index: AcWMjvO1oJAWW8ytTy24jjmTwzCcUg== +From: "Sailer, Denis (YBUSA-CDR)" +To: +X-OriginalArrivalTime: 19 Jul 2005 18:23:25.0323 (UTC) + FILETIME=[F3C955B0:01C58C8E] +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.376 tagged_above=0 required=5 tests=AWL, + HTML_MESSAGE, HTML_TEXT_AFTER_BODY, HTML_TEXT_AFTER_HTML +X-Spam-Level: +X-Archive-Number: 200507/302 +X-Sequence-Number: 13543 + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C58C8E.F3B5F894 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +The thread below has the test case that we were able to use to reproduce +the issue. + +=20 + +http://archives.postgresql.org/pgsql-performance/2004-04/msg00280.php + +=20 + +The last messages on this subject are from April of 2005. Has there +been any successful ways to significantly reduce the impact this has to +multi-processing? I haven't been able to find anything showing a +resolution of some kind. + +=20 + +We are seeing this on two of our machines: + +=20 + +Quad 3.0 GHz XEON with 3GB of memory running PG 7.4.3 with SuSE kernel +2.4 + +=20 + +Dual 2.8 GHz XEON with 2GB of memory running PG 8.0.0 with SuSE kernel +2.4 + +=20 + +=20 + +=20 + + +------_=_NextPart_001_01C58C8E.F3B5F894 +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + + + + + + + + +
+ +

The thread below has the test case that we were able = +to use +to reproduce the issue.

+ +

 

+ +

http://archives.postgresql.org/pgsql-performance/2004-04/msg00280.p= +hp

+ +

 

+ +

The last messages on this subject are from April of +2005.  Has there been any successful ways to significantly reduce = +the +impact this has to multi-processing?  I haven’t been able to = +find anything +showing a resolution of some kind.

+ +

 

+ +

We are seeing this on two of our = +machines:

+ +

 

+ +

Quad 3.0 GHz XEON with 3GB of memory running PG 7.4.3 = +with SuSE +kernel 2.4

+ +

 

+ +

Dual 2.8 GHz XEON with 2GB of memory running PG 8.0.0 = +with SuSE +kernel 2.4

+ +

 

+ +

 

+ +

 

+ +
+ + + + +=00 +------_=_NextPart_001_01C58C8E.F3B5F894-- + +From pgsql-performance-owner@postgresql.org Tue Jul 19 15:38:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CE366529F8 + for ; + Tue, 19 Jul 2005 15:38:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57049-09 + for ; + Tue, 19 Jul 2005 18:38:35 +0000 (GMT) +Received: from dns.deep-purple.com (dns.deep-purple.com [209.61.158.121]) + by svr1.postgresql.org (Postfix) with ESMTP id C4BC6529E1 + for ; + Tue, 19 Jul 2005 15:38:31 -0300 (ADT) +Received: from [192.168.5.4] (82-133-109-237.dyn.gotadsl.co.uk + [82.133.109.237]) (authenticated) + by dns.deep-purple.com (8.11.6/8.11.6) with ESMTP id j6JIcMc05842; + Tue, 19 Jul 2005 13:38:22 -0500 +In-Reply-To: <3FB3AAE149F4AD4D8499E15EE8CF41A3460442@YBCDREX01.corp.ybusa.net> +References: <3FB3AAE149F4AD4D8499E15EE8CF41A3460442@YBCDREX01.corp.ybusa.net> +Mime-Version: 1.0 (Apple Message framework v733) +Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed +Message-Id: +Cc: +Content-Transfer-Encoding: quoted-printable +From: David Hodgkinson +Subject: Re: context-switching issue on Xeon +Date: Tue, 19 Jul 2005 19:38:14 +0100 +To: "Sailer, Denis (YBUSA-CDR)" +X-Mailer: Apple Mail (2.733) +X-RIF3-MailScanner-Information: Please contact the ISP for more information +X-RIF3-MailScanner: Found to be clean +X-RIF3-MailScanner-SpamCheck: not spam, SpamAssassin (score=-4.842, + required 5, autolearn=not spam, AWL 0.06, BAYES_00 -4.90) +X-MailScanner-From: daveh@hodgkinson.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/303 +X-Sequence-Number: 13544 + + +FWIW, I'm seeing this with a client at the moment. 40-60k CS per second +on Dual 3.2GHz. + +There are plenty of other issues we're dealing with, but this is =20 +obviously +disconcerting... + + +On 19 Jul 2005, at 19:23, Sailer, Denis (YBUSA-CDR) wrote: + +> The thread below has the test case that we were able to use to =20 +> reproduce the issue. +> +> +> http://archives.postgresql.org/pgsql-performance/2004-04/msg00280.php +> +> +> The last messages on this subject are from April of 2005. Has =20 +> there been any successful ways to significantly reduce the impact =20 +> this has to multi-processing? I haven=92t been able to find anything =20= + +> showing a resolution of some kind. +> +> +> We are seeing this on two of our machines: +> +> +> Quad 3.0 GHz XEON with 3GB of memory running PG 7.4.3 with SuSE =20 +> kernel 2.4 +> +> +> Dual 2.8 GHz XEON with 2GB of memory running PG 8.0.0 with SuSE =20 +> kernel 2.4 +> +> +> +> +> + + +From pgsql-performance-owner@postgresql.org Tue Jul 19 15:40:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 18C40529F8 + for ; + Tue, 19 Jul 2005 15:40:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71895-02 + for ; + Tue, 19 Jul 2005 18:40:47 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DBBA1529EF + for ; + Tue, 19 Jul 2005 15:40:45 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6JIekuK008217; + Tue, 19 Jul 2005 14:40:46 -0400 (EDT) +To: "Sailer, Denis (YBUSA-CDR)" +Cc: pgsql-performance@postgresql.org +Subject: Re: context-switching issue on Xeon +In-reply-to: <3FB3AAE149F4AD4D8499E15EE8CF41A3460442@YBCDREX01.corp.ybusa.net> +References: <3FB3AAE149F4AD4D8499E15EE8CF41A3460442@YBCDREX01.corp.ybusa.net> +Comments: In-reply-to "Sailer, + Denis (YBUSA-CDR)" + message dated "Tue, 19 Jul 2005 13:23:25 -0500" +Date: Tue, 19 Jul 2005 14:40:46 -0400 +Message-ID: <8216.1121798446@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/304 +X-Sequence-Number: 13545 + +"Sailer, Denis (YBUSA-CDR)" writes: +> http://archives.postgresql.org/pgsql-performance/2004-04/msg00280.php + +> The last messages on this subject are from April of 2005. Has there +> been any successful ways to significantly reduce the impact this has to +> multi-processing? + +CVS tip should largely fix the problem as far as buffer manager +contention goes. + +> I haven't been able to find anything showing a +> resolution of some kind. + +Look at the Feb/March threads concerning buffer manager rewrite, clock +sweep, etc ... eg +http://archives.postgresql.org/pgsql-patches/2005-03/msg00015.php + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jul 19 15:42:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C2A1B529EF + for ; + Tue, 19 Jul 2005 15:41:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60510-07 + for ; + Tue, 19 Jul 2005 18:40:58 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E288529C3 + for ; + Tue, 19 Jul 2005 15:40:56 -0300 (ADT) +Received: (qmail 19500 invoked from network); 19 Jul 2005 20:41:32 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 19 Jul 2005 20:41:32 +0200 +To: "Oliver Crosby" , + "Joshua D. Drake" +Cc: pgsql-performance@postgresql.org +Subject: Re: Looking for tips +References: <1efd553a05071910427b290203@mail.gmail.com> + <42DD3D55.9020508@commandprompt.com> + <1efd553a050719112126b8d981@mail.gmail.com> +Message-ID: +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Date: Tue, 19 Jul 2005 20:40:56 +0200 +In-Reply-To: <1efd553a050719112126b8d981@mail.gmail.com> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/305 +X-Sequence-Number: 13546 + + + +What programming language are these scripts written in ? + +From pgsql-performance-owner@postgresql.org Tue Jul 19 15:42:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 86415529F4 + for ; + Tue, 19 Jul 2005 15:42:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76183-02 + for ; + Tue, 19 Jul 2005 18:42:49 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) + by svr1.postgresql.org (Postfix) with ESMTP id 183F6529C3 + for ; + Tue, 19 Jul 2005 15:42:48 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i16so1281222wra + for ; + Tue, 19 Jul 2005 11:42:49 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=r5DY2JxmIAD0Btdi9i6RSbxAUB6YePn70bDY2i8ZrcTkgLc7EZJtdmvuitTFmpiTmu+0KbE00lx4RRUZ8khIqFwl+uzaxsCKtLPaZ8L6QQYFt9oAx7Ph0a5qekGTe+2gSOaZYFj/2A3q5axspb6TihI/GytSgpuZWimYY/r0hic= +Received: by 10.54.57.79 with SMTP id f79mr846368wra; + Tue, 19 Jul 2005 11:41:51 -0700 (PDT) +Received: by 10.54.150.2 with HTTP; Tue, 19 Jul 2005 11:41:51 -0700 (PDT) +Message-ID: <1efd553a05071911413e50ea90@mail.gmail.com> +Date: Tue, 19 Jul 2005 14:41:51 -0400 +From: Oliver Crosby +Reply-To: Oliver Crosby +To: Richard Huxton +Subject: Re: Looking for tips +Cc: pgsql-performance@postgresql.org +In-Reply-To: <42DD420C.2010306@archonet.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <1efd553a05071910427b290203@mail.gmail.com> + <42DD420C.2010306@archonet.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.123 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/306 +X-Sequence-Number: 13547 + +> Identify what the problem is first of all. Some things to consider: +> - Are there particular queries giving you trouble? +> - Is your load mostly reads or mostly writes? +> - Do you have one user or 100? +> - Are you block-loading data efficiently where necessary? +> - Have you indexed both sides of your foreign-keys where sensible? +> - Are your disks being used effectively? +> - Are your statistics accurate/up to date? + +No queries in particular appear to be a problem. I think it's just the +overall speed. If any of the configuration settings will help make the +simple select queries go faster, that would be ideal. +The load is about 50/50 read/write. +At the moment it's just one user, but the goal is to have a cluster of +servers (probably less than a dozen) updating to a central db. +Indices exist for the fields being searched, but we don't have any foreign = +keys. +I'm not too familiar with effective disk usage or statistics... + +From pgsql-performance-owner@postgresql.org Tue Jul 19 15:45:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5E7A352A0B + for ; + Tue, 19 Jul 2005 15:45:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73990-05 + for ; + Tue, 19 Jul 2005 18:45:18 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) + by svr1.postgresql.org (Postfix) with ESMTP id F0B4052A1F + for ; + Tue, 19 Jul 2005 15:45:17 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i7so1282687wra + for ; + Tue, 19 Jul 2005 11:45:18 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=q72Sx/ixBmW4jiCx115bdQJgfXJ2KfJe0SttRfXKuasSgXRM5Ey99wwFYApNcexJnhMpLZbV18ZI/nEGw455fnhmbdbvmGhH6hEfpni5S82YQXpr8x0uiDdfppxcnDFd3JUbShdeGMJRVEEBGZwk5t7L8FXd7X8tAE0+fywiT1s= +Received: by 10.54.137.2 with SMTP id k2mr847410wrd; + Tue, 19 Jul 2005 11:44:26 -0700 (PDT) +Received: by 10.54.150.2 with HTTP; Tue, 19 Jul 2005 11:44:26 -0700 (PDT) +Message-ID: <1efd553a050719114439b43ec3@mail.gmail.com> +Date: Tue, 19 Jul 2005 14:44:26 -0400 +From: Oliver Crosby +Reply-To: Oliver Crosby +To: PFC +Subject: Re: Looking for tips +Cc: "Joshua D. Drake" , 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: <1efd553a05071910427b290203@mail.gmail.com> + <42DD3D55.9020508@commandprompt.com> + <1efd553a050719112126b8d981@mail.gmail.com> + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.109 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/307 +X-Sequence-Number: 13548 + +> What programming language are these scripts written in ? + +perl. using the DBD:Pg interface instead of command-lining it through psql + +From pgsql-performance-owner@postgresql.org Tue Jul 19 15:50:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 704D2529E1 + for ; + Tue, 19 Jul 2005 15:49:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 72073-08 + for ; + Tue, 19 Jul 2005 18:49:47 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) + by svr1.postgresql.org (Postfix) with ESMTP id 35F79529FC + for ; + Tue, 19 Jul 2005 15:49:46 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 69so405340wra + for ; + Tue, 19 Jul 2005 11:49:47 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=TVsVqRh4sJhShFyw5ePGO/JPuas/pWnWKAB9pCXSW3Bub5Gc6eHQ5lD/AhxvX2XbQo+YgkfHlOpmEAvAbKuHbCWfjCGz7u7Titwn36it/atbFZnBKagUNaXhDj9KvsJyF0HM+iufNe1nxJTiGUFjJxGEWAo0B8t+rPnUJVrBS+E= +Received: by 10.54.37.47 with SMTP id k47mr840228wrk; + Tue, 19 Jul 2005 11:48:54 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Tue, 19 Jul 2005 11:48:54 -0700 (PDT) +Message-ID: <59d991c40507191148e6f9ec5@mail.gmail.com> +Date: Tue, 19 Jul 2005 14:48:54 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Impact of checkpoint_segments under continual load conditions +Cc: PFC , Vivek Khera , + pgsql-performance@postgresql.org +In-Reply-To: <7843.1121796596@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: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c4050719084460b376f1@mail.gmail.com> + <4541.1121788647@sss.pgh.pa.us> + <59d991c40507190930244ba9bb@mail.gmail.com> + <7224.1121791328@sss.pgh.pa.us> + <59d991c4050719095440cd3de5@mail.gmail.com> + <7436.1121792725@sss.pgh.pa.us> + <59d991c405071910133e28031a@mail.gmail.com> + <7843.1121796596@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.148 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/308 +X-Sequence-Number: 13549 + +On 7/19/05, Tom Lane wrote: +> Christopher Petrilli writes: +> >> Are you sure the backend is reading directly from the file, and not +> >> through psql? (\copy, or COPY FROM STDIN, would go through psql.) +>=20 +> > The exact command is: +> > COPY test (columnlist...) FROM '/tmp/loadfile'; +>=20 +> I tried to replicate this by putting a ton of COPY commands like that +> into a file and doing "psql -f file ...". I don't see more than about +> 0.3% CPU going to psql. So there's something funny about your test +> conditions. How *exactly* are you invoking psql? + +It is a subprocess of a Python process, driven using a pexpect +interchange. I send the COPY command, then wait for the '=3D#' to come +back. + +Chris +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Jul 19 15:53:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 90EBD52831 + for ; + Tue, 19 Jul 2005 15:53:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 82527-02 + for ; + Tue, 19 Jul 2005 18:53:15 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 5ADAD5281B + for ; + Tue, 19 Jul 2005 15:53:15 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6JIrD4g008376; + Tue, 19 Jul 2005 14:53:13 -0400 (EDT) +To: Christopher Petrilli +Cc: PFC , Vivek Khera , + pgsql-performance@postgresql.org +Subject: Re: Impact of checkpoint_segments under continual load conditions +In-reply-to: <59d991c40507191148e6f9ec5@mail.gmail.com> +References: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c4050719084460b376f1@mail.gmail.com> + <4541.1121788647@sss.pgh.pa.us> + <59d991c40507190930244ba9bb@mail.gmail.com> + <7224.1121791328@sss.pgh.pa.us> + <59d991c4050719095440cd3de5@mail.gmail.com> + <7436.1121792725@sss.pgh.pa.us> + <59d991c405071910133e28031a@mail.gmail.com> + <7843.1121796596@sss.pgh.pa.us> + <59d991c40507191148e6f9ec5@mail.gmail.com> +Comments: In-reply-to Christopher Petrilli + message dated "Tue, 19 Jul 2005 14:48:54 -0400" +Date: Tue, 19 Jul 2005 14:53:13 -0400 +Message-ID: <8375.1121799193@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/309 +X-Sequence-Number: 13550 + +Christopher Petrilli writes: +> On 7/19/05, Tom Lane wrote: +>> How *exactly* are you invoking psql? + +> It is a subprocess of a Python process, driven using a pexpect +> interchange. I send the COPY command, then wait for the '=#' to come +> back. + +Some weird interaction with pexpect maybe? Try adding "-n" (disable +readline) to the psql command switches. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jul 19 15:58:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5A641529EF + for ; + Tue, 19 Jul 2005 15:58:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79018-06 + for ; + Tue, 19 Jul 2005 18:58:27 +0000 (GMT) +Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.91]) + by svr1.postgresql.org (Postfix) with ESMTP id E48C952869 + for ; + Tue, 19 Jul 2005 15:58:25 -0300 (ADT) +Received: from Courts-MTA by gwmta.wicourts.gov + with Novell_GroupWise; Tue, 19 Jul 2005 13:58:24 -0500 +Message-Id: +X-Mailer: Novell GroupWise Internet Agent 6.5.2 +Date: Tue, 19 Jul 2005 13:58:20 -0500 +From: "Kevin Grittner" +To: , +Cc: +Subject: Re: Looking for tips +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, hits=0.016 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/310 +X-Sequence-Number: 13551 + +Hi Oliver, + +We had low resource utilization and poor throughput on inserts of +thousands of rows within a single database transaction. There were a +lot of configuration parameters we changed, but the one which helped the +most was wal_buffers -- we wound up setting it to 1000. This may be +higher than it needs to be, but when we got to something which ran well, +we stopped tinkering. The default value clearly caused a bottleneck. + +You might find this page useful: + +http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html + +-Kevin + + +>>> Oliver Crosby 07/19/05 1:21 PM >>> +I was hoping to start with tuning postgres to match the hardware, but +in any case.. + +The queries are all simple insert or select statements on single tables. +Eg. select x from table where y=?; or insert into table (a, b, c) +values (?, ?, ?); +In the case of selects where it's a large table, there's an index on +the column being searched, so in terms of the example above, x is +either a pkey column or other related field, and y is a non-pkey +column. + +I'm not sure what you mean by structure. + +I tried explain analyse on the individual queries, but I'm not sure +what can be done to manipulate them when they don't do much. + +My test environment has about 100k - 300k rows in each table, and for +production I'm expecting this to be in the order of 1M+. + +The OS is Redhat Enterprise 3. + +I'm using a time command when I call the scripts to get a total +running time from start to finish. + +I don't know what we have for RAID, but I suspect it's just a single +10k or 15k rpm hdd. +------------------------------------------------------------------------------------------------------------------------ +I'll try your recommendations for shared_buffers and +effective_cache_size. Thanks John! + +We're trying to improve performance on a log processing script to the +point where it can be run as close as possible to realtime. A lot of +what gets inserted depends on what's already in the db, and it runs +item-by-item... so unfortunately I can't take advantage of copy. + +We tried dropping indices, copying data in, then rebuilding. It works +great for a bulk import, but the processing script went a lot slower +without them. (Each insert is preceeded by a local cache check and +then a db search to see if an ID already exists for an item.) + +We have no foreign keys at the moment. Would they help? + + +On 7/19/05, Joshua D. Drake wrote: +> Oliver Crosby wrote: +> > Hi, +> > I'm running Postgres 7.4.6 on a dedicated server with about 1.5gigs +of ram. +> > Running scripts locally, it takes about 1.5x longer than mysql, and +the +> > load on the server is only about 21%. +> +> What queries? +> What is your structure? +> Have you tried explain analyze? +> How many rows in the table? +> Which OS? +> How are you testing the speed? +> What type of RAID? +> +> +> +> -- +> Your PostgreSQL solutions company - Command Prompt, Inc. +1.800.492.2240 +> PostgreSQL Replication, Consulting, Custom Programming, 24x7 support +> Managed Services, Shared and Dedicated Hosting +> Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ +> + +---------------------------(end of broadcast)--------------------------- +TIP 2: Don't 'kill -9' the postmaster + + +From pgsql-performance-owner@postgresql.org Tue Jul 19 16:02:32 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5949752A03 + for ; + Tue, 19 Jul 2005 16:02:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88427-06 + for ; + Tue, 19 Jul 2005 19:02:17 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 846D1529FA + for ; + Tue, 19 Jul 2005 16:02:16 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6JJ10ZW008447; + Tue, 19 Jul 2005 15:01:00 -0400 (EDT) +To: Oliver Crosby +Cc: "Joshua D. Drake" , pgsql-performance@postgresql.org +Subject: Re: Looking for tips +In-reply-to: <1efd553a050719112126b8d981@mail.gmail.com> +References: <1efd553a05071910427b290203@mail.gmail.com> + <42DD3D55.9020508@commandprompt.com> + <1efd553a050719112126b8d981@mail.gmail.com> +Comments: In-reply-to Oliver Crosby + message dated "Tue, 19 Jul 2005 14:21:22 -0400" +Date: Tue, 19 Jul 2005 15:01:00 -0400 +Message-ID: <8446.1121799660@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/311 +X-Sequence-Number: 13552 + +Oliver Crosby writes: +> The queries are all simple insert or select statements on single tables. +> Eg. select x from table where y=?; or insert into table (a, b, c) +> values (?, ?, ?); +> In the case of selects where it's a large table, there's an index on +> the column being searched, so in terms of the example above, x is +> either a pkey column or other related field, and y is a non-pkey +> column. + +If you're running only a single query at a time (no multiple clients), +then this is pretty much the definition of a MySQL-friendly workload; +I'd have to say we are doing really well if we are only 50% slower. +Postgres doesn't have any performance advantages until you get into +complex queries or a significant amount of concurrency. + +You could possibly get some improvement if you can re-use prepared plans +for the queries; but this will require some fooling with the client code +(I'm not sure if DBD::Pg even has support for it at all). + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jul 19 16:05:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 04FA7529F5 + for ; + Tue, 19 Jul 2005 16:05:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87301-06 + for ; + Tue, 19 Jul 2005 19:05:28 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 34F1F529F8 + for ; + Tue, 19 Jul 2005 16:05:26 -0300 (ADT) +Received: (qmail 20764 invoked from network); 19 Jul 2005 21:06:03 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 19 Jul 2005 21:06:03 +0200 +To: "Christopher Petrilli" , + "Tom Lane" +Cc: "Vivek Khera" , pgsql-performance@postgresql.org +Subject: Re: Impact of checkpoint_segments under continual load conditions +References: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c4050719084460b376f1@mail.gmail.com> + <4541.1121788647@sss.pgh.pa.us> + <59d991c40507190930244ba9bb@mail.gmail.com> + <7224.1121791328@sss.pgh.pa.us> + <59d991c4050719095440cd3de5@mail.gmail.com> + <7436.1121792725@sss.pgh.pa.us> + <59d991c405071910133e28031a@mail.gmail.com> + <7843.1121796596@sss.pgh.pa.us> + <59d991c40507191148e6f9ec5@mail.gmail.com> +Message-ID: +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Date: Tue, 19 Jul 2005 21:05:27 +0200 +In-Reply-To: <59d991c40507191148e6f9ec5@mail.gmail.com> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/312 +X-Sequence-Number: 13553 + + +> It is a subprocess of a Python process, driven using a pexpect +> interchange. I send the COPY command, then wait for the '=#' to come +> back. + + did you try sending the COPY as a normal query through psycopg ? + +From pgsql-performance-owner@postgresql.org Tue Jul 19 16:12:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D62B5529FA + for ; + Tue, 19 Jul 2005 16:12:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94696-06 + for ; + Tue, 19 Jul 2005 19:11:52 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) + by svr1.postgresql.org (Postfix) with ESMTP id 6E589529F9 + for ; + Tue, 19 Jul 2005 16:11:50 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i2so1268136wra + for ; + Tue, 19 Jul 2005 12:11:52 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=ExHRsy09rEcA4teGs23Jxob88YFIHdpzrWHDDtcQSwZlsCWRWruUQhfIDpZjSS08GUidVM9T7K/Zr3TtN/RttCfmT78kQBne/33tGcwJ7ls5X3EGR1YXTIphAcGg661oEGzp7vVk35aeXvWDcYdwngPx4RRun8n/X3QrPol/Aws= +Received: by 10.54.57.79 with SMTP id f79mr857445wra; + Tue, 19 Jul 2005 12:11:15 -0700 (PDT) +Received: by 10.54.150.2 with HTTP; Tue, 19 Jul 2005 12:11:15 -0700 (PDT) +Message-ID: <1efd553a05071912111f6a3121@mail.gmail.com> +Date: Tue, 19 Jul 2005 15:11:15 -0400 +From: Oliver Crosby +Reply-To: Oliver Crosby +To: Tom Lane +Subject: Re: Looking for tips +Cc: "Joshua D. Drake" , pgsql-performance@postgresql.org +In-Reply-To: <8446.1121799660@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: <1efd553a05071910427b290203@mail.gmail.com> + <42DD3D55.9020508@commandprompt.com> + <1efd553a050719112126b8d981@mail.gmail.com> + <8446.1121799660@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.083 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/313 +X-Sequence-Number: 13554 + +> If you're running only a single query at a time (no multiple clients), +> then this is pretty much the definition of a MySQL-friendly workload; +> I'd have to say we are doing really well if we are only 50% slower. +> Postgres doesn't have any performance advantages until you get into +> complex queries or a significant amount of concurrency. + +The original port was actually twice as slow. It improved quite a bit +after I added transactions and trimmed the schema a bit. + +> You could possibly get some improvement if you can re-use prepared plans +> for the queries; but this will require some fooling with the client code +> (I'm not sure if DBD::Pg even has support for it at all). + +Aye. We have prepared statements. + +From pgsql-performance-owner@postgresql.org Tue Jul 19 16:12:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B130052A0B + for ; + Tue, 19 Jul 2005 16:12:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89678-07 + for ; + Tue, 19 Jul 2005 19:12:08 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id 72306529FC + for ; + Tue, 19 Jul 2005 16:12:07 -0300 (ADT) +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 1DuxVb-0007Bb-MB + for pgsql-performance@postgresql.org; Tue, 19 Jul 2005 21:12:07 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1DuxVb-0004UN-00 + for ; Tue, 19 Jul 2005 21:12:03 +0200 +Date: Tue, 19 Jul 2005 21:12:03 +0200 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: Looking for tips +Message-ID: <20050719191203.GA16813@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <1efd553a05071910427b290203@mail.gmail.com> + <42DD3D55.9020508@commandprompt.com> + <1efd553a050719112126b8d981@mail.gmail.com> + <8446.1121799660@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <8446.1121799660@sss.pgh.pa.us> +X-Operating-System: Linux 2.6.11.8 on a i686 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.018 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/314 +X-Sequence-Number: 13555 + +On Tue, Jul 19, 2005 at 03:01:00PM -0400, Tom Lane wrote: +> You could possibly get some improvement if you can re-use prepared plans +> for the queries; but this will require some fooling with the client code +> (I'm not sure if DBD::Pg even has support for it at all). + +Newer versions has, when compiled against the 8.0 client libraries and using +an 8.0 server (AFAIK). + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Tue Jul 19 16:14:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 722A852A03 + for ; + Tue, 19 Jul 2005 16:14:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01354-05 + for ; + Tue, 19 Jul 2005 19:14:05 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id F254A52A00 + for ; + Tue, 19 Jul 2005 16:14:04 -0300 (ADT) +Received: (qmail 21110 invoked from network); 19 Jul 2005 21:14:41 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 19 Jul 2005 21:14:41 +0200 +Date: Tue, 19 Jul 2005 21:14:04 +0200 +To: "Oliver Crosby" , + "Richard Huxton" +Subject: Re: Looking for tips +Cc: pgsql-performance@postgresql.org +References: <1efd553a05071910427b290203@mail.gmail.com> + <42DD420C.2010306@archonet.com> + <1efd553a05071911413e50ea90@mail.gmail.com> +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-ID: +In-Reply-To: <1efd553a05071911413e50ea90@mail.gmail.com> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/315 +X-Sequence-Number: 13556 + + + I can't say wether MySQL is faster for very small queries (like +SELECT'ing one row based on an indexed field). + That's why I was asking you about the language... + + I assume you're using a persistent connection. + For simple queries like this, PG 8.x seemed to be a lot faster than PG +7.x. Have you tried 8 ? + I was asking you which language, because for such really small queries +you have to take into account the library overhead. For instance, in PHP a +simple query can be 10 times slower in Postgres than in MySQL and I +believe it is because php's MySQL driver has seen a lot of optimization +whereas the postgres driver has not. Interestingly, the situation is +reversed with Python : its best postgres driver (psycopg 2) is a lot +faster than the MySQL adapter, and faster than both php adapters (a lot +faster). + + The same query can get (this is from the back of my head): + +PHP+Postgres 3-5 ms +Python+MySQL 1ms +PHP+MySQL 0.5 ms +Python+Postgres 0.15 ms + +And yes, I had queries executing in 150 microseconds or so, this includes +time to convert the results to native python objects ! This was on a loop +of 10000 times the same query. But psycopg2 is fast. The overhead for +parsing a simple query and fetching just a row is really small. + +This is on my Centrino 1.6G laptop. + +From pgsql-performance-owner@postgresql.org Tue Jul 19 16:16:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C8F7852A38 + for ; + Tue, 19 Jul 2005 16:16:35 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94696-10 + for ; + Tue, 19 Jul 2005 19:16:34 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 49E6352A2F + for ; + Tue, 19 Jul 2005 16:16:33 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6JJGVhO008614; + Tue, 19 Jul 2005 15:16:31 -0400 (EDT) +To: Oliver Crosby +Cc: "Joshua D. Drake" , pgsql-performance@postgresql.org +Subject: Re: Looking for tips +In-reply-to: <1efd553a05071912111f6a3121@mail.gmail.com> +References: <1efd553a05071910427b290203@mail.gmail.com> + <42DD3D55.9020508@commandprompt.com> + <1efd553a050719112126b8d981@mail.gmail.com> + <8446.1121799660@sss.pgh.pa.us> + <1efd553a05071912111f6a3121@mail.gmail.com> +Comments: In-reply-to Oliver Crosby + message dated "Tue, 19 Jul 2005 15:11:15 -0400" +Date: Tue, 19 Jul 2005 15:16:31 -0400 +Message-ID: <8613.1121800591@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/316 +X-Sequence-Number: 13557 + +Oliver Crosby writes: +>> You could possibly get some improvement if you can re-use prepared plans +>> for the queries; but this will require some fooling with the client code +>> (I'm not sure if DBD::Pg even has support for it at all). + +> Aye. We have prepared statements. + +Ah, but are they really prepared, or is DBD::Pg faking it by inserting +parameter values into the query text and then sending the assembled +string as a fresh query? It wasn't until about 7.4 that we had adequate +backend support to let client libraries support prepared queries +properly, and I'm unsure that DBD::Pg has been updated to take advantage +of that support. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jul 19 16:22:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 45D82529F8 + for ; + Tue, 19 Jul 2005 16:22:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10783-09 + for ; + Tue, 19 Jul 2005 19:22:16 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) + by svr1.postgresql.org (Postfix) with ESMTP id 845C652A62 + for ; + Tue, 19 Jul 2005 16:22:14 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i35so1264259wra + for ; + Tue, 19 Jul 2005 12:22:14 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=Z35hxky/1nuUl1h554gAwOeHoL+fHeQOdYBmJbmpFfJcQ5UnGcEBrj/ZYlHqQKkTo467ESS+fd/XuB9VaroSCLDtfO/MQp+r9mhOI5e4FwwRIzVdU7XGGfJXTHIIyLruBNl2+hMkpf+zpnOCzctf1SGYA/q2FQAdw7EH0Gxum88= +Received: by 10.54.107.2 with SMTP id f2mr851530wrc; + Tue, 19 Jul 2005 12:22:07 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Tue, 19 Jul 2005 12:22:07 -0700 (PDT) +Message-ID: <59d991c4050719122213ac3d81@mail.gmail.com> +Date: Tue, 19 Jul 2005 15:22:07 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Impact of checkpoint_segments under continual load conditions +Cc: PFC , Vivek Khera , + pgsql-performance@postgresql.org +In-Reply-To: <8375.1121799193@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: <59d991c4050717100874c08a86@mail.gmail.com> + <4541.1121788647@sss.pgh.pa.us> + <59d991c40507190930244ba9bb@mail.gmail.com> + <7224.1121791328@sss.pgh.pa.us> + <59d991c4050719095440cd3de5@mail.gmail.com> + <7436.1121792725@sss.pgh.pa.us> + <59d991c405071910133e28031a@mail.gmail.com> + <7843.1121796596@sss.pgh.pa.us> + <59d991c40507191148e6f9ec5@mail.gmail.com> + <8375.1121799193@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.145 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/317 +X-Sequence-Number: 13558 + +On 7/19/05, Tom Lane wrote: +> Christopher Petrilli writes: +> > On 7/19/05, Tom Lane wrote: +> >> How *exactly* are you invoking psql? +>=20 +> > It is a subprocess of a Python process, driven using a pexpect +> > interchange. I send the COPY command, then wait for the '=3D#' to come +> > back. +>=20 +> Some weird interaction with pexpect maybe? Try adding "-n" (disable +> readline) to the psql command switches. + +Um... WOW! + +=3D=3D> pgsql_benchmark_803_bigbuffers10000_noreadline.txt <=3D=3D +0 0.0319459438324 0.0263829231262 +1 0.0303978919983 0.0263390541077 +2 0.0306499004364 0.0273139476776 +3 0.0306959152222 0.0270659923553 +4 0.0307791233063 0.0278429985046 +5 0.0306351184845 0.0278820991516 +6 0.0307800769806 0.0335869789124 +7 0.0408310890198 0.0370559692383 +8 0.0371310710907 0.0344209671021 +9 0.0372560024261 0.0334041118622 + +=3D=3D> pgsql_benchmark_803_bigbuffers10000.txt <=3D=3D +0 0.0352520942688 0.149132013321 +1 0.0320160388947 0.146126031876 +2 0.0307128429413 0.139330863953 +3 0.0306718349457 0.139590978622 +4 0.0307030677795 0.140225172043 +5 0.0306420326233 0.140012979507 +6 0.0307261943817 0.139672994614 +7 0.0307750701904 0.140661001205 +8 0.0307800769806 0.141661167145 +9 0.0306720733643 0.141198158264 =20 + +First column is iteration, second is "gen time" to generate the load +file, and 3rd is "load time". + +It doesn't stay QUITE that low, but it stays lower... quite a bit.=20 +We'll see what happens over time. + +Chris +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Tue Jul 19 16:34:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 79A11528BB + for ; + Tue, 19 Jul 2005 16:34:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 15817-09 + for ; + Tue, 19 Jul 2005 19:34:27 +0000 (GMT) +Received: from prospect.stortek.com (prospect.stortek.com [129.80.22.147]) + by svr1.postgresql.org (Postfix) with ESMTP id 020FF52A22 + for ; + Tue, 19 Jul 2005 16:34:22 -0300 (ADT) +Received: from prospect.stortek.com (localhost [127.0.0.1]) + by prospect.stortek.com (8.12.10/8.12.0) with ESMTP id j6JJYMWl023978 + for ; + Tue, 19 Jul 2005 13:34:22 -0600 (MDT) +Received: from unix.stortek.com (bullion.stortek.com [129.80.16.43]) + by prospect.stortek.com (8.12.10/8.12.0) with ESMTP id j6JJYLbc023975; + Tue, 19 Jul 2005 13:34:21 -0600 (MDT) +Received: from C118181.stortek.com (c118181.stortek.com [129.80.81.172]) + by unix.stortek.com (8.12.10/8.12.0) with ESMTP id j6JJYKZb025007; + Tue, 19 Jul 2005 13:34:20 -0600 (MDT) +Date: Tue, 19 Jul 2005 13:34:17 -0600 +From: Robert Creager +To: Tom Lane +Cc: Robert Creager , + pgsql-performance@postgresql.org, + Andy Hewitt III +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS issue? +Message-ID: <20050719133417.00001473@C118181.stortek.com> +In-Reply-To: <7322.1121792062@sss.pgh.pa.us> +References: <20050718114952.00004ac5@C118181.stortek.com> + <15472.1121709173@sss.pgh.pa.us> + <20050719105014.00007635@C118181.stortek.com> + <7322.1121792062@sss.pgh.pa.us> +Organization: StorageTek +X-Mailer: Sylpheed-Claws 1.0.4.1 Win32 (GTK+ 1.3.0; Win32) +Mime-Version: 1.0 +Content-Type: multipart/mixed; + boundary=Multipart_Tue__19_Jul_2005_13_34_17_-0600_JtTr6Ylk_Fb3N5yn +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/318 +X-Sequence-Number: 13559 + + +--Multipart_Tue__19_Jul_2005_13_34_17_-0600_JtTr6Ylk_Fb3N5yn +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On Tue, 19 Jul 2005 12:54:22 -0400 +Tom Lane wrote: + +> Robert Creager writes: +> +> Hmm, I hadn't thought about the possible impact of multiple concurrent +> vacuums. Is the problem caused by that, or has performance already gone +> into the tank by the time the cron-driven vacuums are taking long enough +> to overlap? + +All statements over 5 seconds are logged. Vacuums are running on the 5 minute mark. + +Log file shows the first query starts going bad a 9:32:15 (7 seconds), although the second query start before the first . The first vacuum statement logged shows 1148 seconds completing at 9:54:09, so starting at 9:35. Looks like the vacuum is an innocent bystander of the problem. + +The first problem queries are below. Additionally, I've attached 5 minutes (bzipped) of logs starting at the first event below. + +Jul 19 09:32:15 annette postgres[17029]: [2-1] LOG: duration: 7146.168 ms statement: +Jul 19 09:32:15 annette postgres[17029]: [2-2] ^I SELECT location_id, location_type.name AS type, library, rail +Jul 19 09:32:15 annette postgres[17029]: [2-3] ^I FROM location_lock JOIN location USING( location_id ) +Jul 19 09:32:15 annette postgres[17029]: [2-4] ^I JOIN location_type USING( location_type_id ) +Jul 19 09:32:15 annette postgres[17029]: [2-5] ^I WHERE test_session_id = '5264' +Jul 19 09:32:20 annette postgres[17092]: [2-1] LOG: duration: 13389.730 ms statement: +Jul 19 09:32:20 annette postgres[17092]: [2-2] ^I SELECT location_type.name AS location_type_name, +Jul 19 09:32:20 annette postgres[17092]: [2-3] ^I library, rail, col, side, row, location_id, +Jul 19 09:32:20 annette postgres[17092]: [2-4] ^I hli_lsm, hli_panel, hli_row, hli_col +Jul 19 09:32:20 annette postgres[17092]: [2-5] ^I FROM location JOIN location_type USING( location_type_id ) +Jul 19 09:32:20 annette postgres[17092]: [2-6] ^I JOIN complex USING( library_id ) +Jul 19 09:32:20 annette postgres[17092]: [2-7] ^I LEFT OUTER JOIN hli_location USING( location_id ) +Jul 19 09:32:20 annette postgres[17092]: [2-8] ^I LEFT OUTER JOIN application USING( application_id ) +Jul 19 09:32:20 annette postgres[17092]: [2-9] ^I WHERE complex.complex_id = '13' +Jul 19 09:32:20 annette postgres[17092]: [2-10] ^I AND location_id NOT IN +Jul 19 09:32:20 annette postgres[17092]: [2-11] ^I (SELECT location_id +Jul 19 09:32:20 annette postgres[17092]: [2-12] ^I FROM location_lock) +Jul 19 09:32:20 annette postgres[17092]: [2-13] ^I AND location_id NOT IN +Jul 19 09:32:20 annette postgres[17092]: [2-14] ^I (SELECT location_id +Jul 19 09:32:20 annette postgres[17092]: [2-15] ^I FROM cartridge) +Jul 19 09:32:20 annette postgres[17092]: [2-16] ^IAND (location_type.name ~ 'cell' AND application.name ~ 'hli' AND hli_lsm = 1 AND col BETWEEN -2 AND 2) +Jul 19 09:32:20 annette postgres[17092]: [2-17] ^I +Jul 19 09:32:20 annette postgres[17092]: [2-18] ^I ORDER BY location.usage_count, location.rand LIMIT 1 +Jul 19 09:32:20 annette postgres[17092]: [2-19] ^I FOR UPDATE OF location + +Cheers, +Rob + + +--Multipart_Tue__19_Jul_2005_13_34_17_-0600_JtTr6Ylk_Fb3N5yn +Content-Type: application/x-bzip2; name=pg.log.bz2 +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; filename=pg.log.bz2 + +QlpoOTFBWSZTWWjrIOgAs/Z/gBI2YgBQ73/3P/ffq77v//FgNUAhAAAA74hFHQAABgTcfc3LMAfK +Y+A6XWAALx7liSe5uUPs97PvvrqXvPvePln33zt4PZ73ij3idwXB26l3RnB73cTj7AAJK8BGlN2x +pI3gAAAAAA77wyjyA+bgtAGkENVQGYaAMoiiqDaIGgyGIyAA0MIwgZGBpmkoQikaepj1RoAADQGJ +o0GhoBoaBj1UlQFMmAACYAAAAEwTEZNMQSeqUmpEKepNDQ0AMjQ0epiABiMQDCATVSUnmmIp6mjK +GhoAA0ADQ0A0yAAClIgiBCYpMiNPQg8p6RoyaPUw1GjygaMNRBgAwZvxv+L5Hx/R9+YiB9v9q9+g +HGYUSqZJINmStCmZEz+CQBPNiW5zeBszY2Iht4SRzALqZCmZYCUolktQbFP4tZisiWS1BsU80GZl +gJWRLJag2KVrAFZlMkUGwz3QBKuJYnSGxTzWAKzKZIoNlsxMxLbu6Gy2bNk0xJIbLZiZNMSSGzJW +hTyZmpYCebEtzm8DZyelWoiGWoocxmCSNMkkGy2YmTTEkjOOjtygBACDvJ4oaIAQAgBBTucGZvjq +GePHPhZxwd+Q8CAEFAA7cEkzte3PZduEvHsaJ+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zWs444547aznO/YgvmPzKP6ylX+kf3hNyH +86S6pHH2+u6b++9lve9cbLmZQMwAzEAYkAJIAxIAzADMAMwASwCULmKgZgBmYgDMLbcxKkzMkmJS +BhbalbbUkqEoXFbbUrbbmW21K224spElJEpSySq224q8zGBmBMUpbittqWUJQqVttzEq0kwEsGsd +olhIsUlMSCKUtzFQMwCULitpiQFuK2JZLMSkmJSRJSURbbiygJIAWIALbcVttSttuK22pW0WAGV5 +lCUKstpmLMyeX24vsorc5F4ikUikUikUikUitzkXiKRW5yLxFIrczFMGNtttimEUyMbbFMIpkY2K +Zzc25F4ikVuci8RSK3OReIrc2225F4ikUitzkXiKRW5ttmZmZtq3m8z9A4CfUJ+8J+KI7iPeI1Ee +AnEGhPA6UdQaE/JCvKjuI6iPt8X1ffEzMb/W7XX9Z57VzS+Mbxyxt5vbxaF587XXrz2rml8Y3jlj +bze3i0Lz52uvXntXNL4xvHLFvN7eLQvPna69ePajS+Mbxyxt5vbxaF587XXrz2rml8Y3jljbze3i +0Lz52uvXntXNL4xvHLFvNbuxG8c1vL28WhefOrr1489OVGlzG8cWNrBalB0ximNPHgtrJq1DWJt6 +8m81GlzG+OWNne+d83t6tD403lRpcxvjljb9a3Z7G8lh160k7B4pIpZGq1HXjeFNaWtN2uJzm5xG +k0217GQbiIy6a452U6muaabVkxttTg4lxS48sjx7sI5wp66zFfarml8YtFuvteLQ8aZ9fbzrwHnn +pK+XdJy5Bhmuka6o018eNQUeVGmvHirzUU148agok0fa3c6uWS24ZnyvpZNt0Ie3V5fFoXvztdfT +z5X0slt4Mz59VeNL6Y305Yt5Xqybb6hD27re3vvncprXS+ldavJtPmvd8uWhefXa6+nntXNL4xvH +LFn1ou+ld1UW+lvrL1aF79drr149qNL4xvHLFvK9WTbfUIe3V5erQvfna6+nnu1ezcxrvrXzyo0v +pjeuWNvKjS5jeOWLeb28WhefO119PPauaXxjeOWNvN7eLQvPna69ee1c0vjG8csW83t4tC8+drr1 +49qNL4xvHNY2sM3FkS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+8AAyxq7y3dHzZkPUoBgzoOOcuo2dgvDW/Ha +2qv6FWry0+lWlWr8/0gANttt7PW70TTbbpbbba3bW5a22222222222222ud3dW7IbuyG7bbdkkjb +bbZd3d27u7Ld3dg22222m2m251yu7u7ggDgAhDnDXd3d3dxAGtr71adr8tSu1flmC0aryaC3MJgs +JsnAuwAzgBnADOAwcAMTELI8iLvDSzbURANobRzd+WZmDASsfZgbFUU8KrkSr0E+v4IwzjQ72rfN +qGwRL24nRajch43AnVBOr8wccH56NHPJHSCCOxZGB/Lrrir6+jyKu4F7O9egOnNt9y7qPKFbyFUZ +o87d2IBYTzzcLxFZpIr42oYJmAxx75mZmY22222356edjbbbdttttrdtUlrbbbbbbbbbbbbbbfi3 +d3ZN3dIbpbbskkbbbRbtKWuW2uFAAAAAACSAAgAAtLHKwbkkklttttoAASQAAAAK22222m2m3HG3 +l3d3d3cQBrXa/OrK/Ku2t5vvVcnErg1bNybFsWhcRsnjvx4idrc01GC6jy31EVd7NfADMA93ggRC +0aJ54a885SRdZELN98vOZrjmSVz8fHx5XriO3V3TBnFy8czPBOckgMfKgPYO4A3kOnvXh/B3QG7A +jl8d9oBgOXexIoBgFB73K8e2eC9uPXz6451143Iyk+IjFWvGZmZjbbbbbezv4vVjbbbe7u7u7u7r +e7uwh76AAAAE+e/Pfnp7777eeee+wu7rbbbbbgbo5d1u7d3W5d0AAAAAABgSAAAD3buua2DYADYN +7obt3d3bu7ugAAAAAALFd0s1rWtFeonr7HQ5PJk3bjgWo4FwdE4FuxGp7eMznzx6d89tPOd9a85L +usUQctziDxjzfwwDTmaZedEmhZzeZBsQYyQbPx8VLAM3gwLrvnr0/NAYDhsJGKNUJyFpYMA8HcXc +8shduQGAW8FXFkVt0wYDCHrKAag/Z1+1ynp41WAwHNd7alGS881gwHMD6uWsfXc5HFAUzwPoyE4A +YD4YBpMlnd3eawCEySTEJgl2Mjum0aAqiDbzataq+x9669SasNHqaK1NXsqzNePbfPnvp0769cRs +m5iBciopuW6zd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rSpbbV/8qWrb7RaMZGkyRMYlKMsWtf69WrEqcKJ6gmI +j6RGqSyI8FKuBOhMCeKVOaUtUqYSA/dok7ijXUVT6QkHwNQkHXA+Q4KPGRGUF2+kKJ2yJuq7lVLr +JOgitkgMj8ISD20pH3oT4QtvPRSd0iZVZkTmqSq7RUvQfAT5AnEK0MUfRUMkn+yFwIXHzlSVWeaJ +OSrMTIjIOvSoo9qVPv3FIOJI+oJ13JMiOZJtEc0k3Sp9oSD2CfgPuJwJok4yQOwh6x7QkGUFzJNw +kGqqlWtCnxKS8wkHrAuBMIo4CftH3/TCQevQySM3QX4tFH1iMjxmZgAAAAAAAAAAAAqte7Va/Da1 +t+NoXFFJ1bpSv/F3JFOFCQaOsg6A + +--Multipart_Tue__19_Jul_2005_13_34_17_-0600_JtTr6Ylk_Fb3N5yn-- + +From pgsql-performance-owner@postgresql.org Tue Jul 19 16:36:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0C252528A6 + for ; + Tue, 19 Jul 2005 16:36:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14737-07 + for ; + Tue, 19 Jul 2005 19:36:07 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id B181152A0D + for ; + Tue, 19 Jul 2005 16:36:02 -0300 (ADT) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1Duxso-0007WX-0e + for pgsql-performance@postgresql.org; Tue, 19 Jul 2005 21:36:03 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1Duxsn-0005dj-00 + for ; Tue, 19 Jul 2005 21:36:01 +0200 +Date: Tue, 19 Jul 2005 21:36:01 +0200 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: Looking for tips +Message-ID: <20050719193601.GA21311@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <1efd553a05071910427b290203@mail.gmail.com> + <42DD3D55.9020508@commandprompt.com> + <1efd553a050719112126b8d981@mail.gmail.com> + <8446.1121799660@sss.pgh.pa.us> + <1efd553a05071912111f6a3121@mail.gmail.com> + <8613.1121800591@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <8613.1121800591@sss.pgh.pa.us> +X-Operating-System: Linux 2.6.11.8 on a i686 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.017 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/319 +X-Sequence-Number: 13560 + +On Tue, Jul 19, 2005 at 03:16:31PM -0400, Tom Lane wrote: +> Ah, but are they really prepared, or is DBD::Pg faking it by inserting +> parameter values into the query text and then sending the assembled +> string as a fresh query? + +They are really prepared. + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Tue Jul 19 16:53:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C3F3E528A6 + for ; + Tue, 19 Jul 2005 16:53:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34282-04 + for ; + Tue, 19 Jul 2005 19:53:07 +0000 (GMT) +Received: from sccrmhc11.comcast.net (sccrmhc11.comcast.net [204.127.202.55]) + by svr1.postgresql.org (Postfix) with ESMTP id B485A52A0D + for ; + Tue, 19 Jul 2005 16:53:05 -0300 (ADT) +Received: from jefftrout.com ([24.147.120.205]) + by comcast.net (sccrmhc11) with SMTP + id <2005071919530501100qg2nae>; Tue, 19 Jul 2005 19:53:05 +0000 +Received: (qmail 85244 invoked from network); 19 Jul 2005 19:59:18 -0000 +Received: from c-24-147-120-205.hsd1.ma.comcast.net (HELO ?192.168.0.106?) + (24.147.120.205) + by 192.168.0.109 with SMTP; 19 Jul 2005 19:59:18 -0000 +In-Reply-To: <20050719193601.GA21311@uio.no> +References: <1efd553a05071910427b290203@mail.gmail.com> + <42DD3D55.9020508@commandprompt.com> + <1efd553a050719112126b8d981@mail.gmail.com> + <8446.1121799660@sss.pgh.pa.us> + <1efd553a05071912111f6a3121@mail.gmail.com> + <8613.1121800591@sss.pgh.pa.us> <20050719193601.GA21311@uio.no> +Mime-Version: 1.0 (Apple Message framework v733) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <654C15AD-4ADF-4792-8082-BE94ECF86F3A@torgo.978.org> +Cc: pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: Jeff Trout +Subject: Re: Looking for tips +Date: Tue, 19 Jul 2005 15:53:04 -0400 +To: "Steinar H. Gunderson" +X-Mailer: Apple Mail (2.733) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/320 +X-Sequence-Number: 13561 + + +On Jul 19, 2005, at 3:36 PM, Steinar H. Gunderson wrote: + +> On Tue, Jul 19, 2005 at 03:16:31PM -0400, Tom Lane wrote: +> +>> Ah, but are they really prepared, or is DBD::Pg faking it by +>> inserting +>> parameter values into the query text and then sending the assembled +>> string as a fresh query? +>> +> +> They are really prepared. + +That depends on what version you are using. Older versions did what +Tom mentioned rather than sending PREPARE & EXECUTE. + +Not sure what version that changed in. + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + + +From pgsql-patches-owner@postgresql.org Tue Jul 19 16:55:11 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9EE6A52833 + for ; + Tue, 19 Jul 2005 16:54:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34623-07 + for ; + Tue, 19 Jul 2005 19:54:36 +0000 (GMT) +Received: from smtp.osdl.org (smtp.osdl.org [65.172.181.4]) + by svr1.postgresql.org (Postfix) with ESMTP id 3BC2052A38 + for ; + Tue, 19 Jul 2005 16:54:33 -0300 (ADT) +Received: from ibm-b.pdx.osdl.net (fw.osdl.org [65.172.181.6]) + (authenticated bits=0) + by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j6JJsVjA003280 + (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); + Tue, 19 Jul 2005 12:54:32 -0700 +Message-Id: <200507191954.j6JJsVjA003280@smtp.osdl.org> +Date: Tue, 19 Jul 2005 12:54:53 -0700 +From: Mark Wong +To: "Alon Goldshuv" +Cc: pgsql-patches@postgresql.org +Subject: Re: COPY FROM performance improvements +In-Reply-To: +References: + +Organization: OSDL +X-Mailer: Sylpheed-Claws 1.0.4a (GTK+ 1.2.10; i686-pc-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-MIMEDefang-Filter: osdl$Revision: 1.113 $ +X-Scanned-By: MIMEDefang 2.36 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/381 +X-Sequence-Number: 16721 + +On Thu, 14 Jul 2005 17:22:18 -0700 +"Alon Goldshuv" wrote: + +> I revisited my patch and removed the code duplications that were there, and +> added support for CSV with buffered input, so CSV now runs faster too +> (although it is not as optimized as the TEXT format parsing). So now +> TEXT,CSV and BINARY are all parsed in CopyFrom(), like in the original file. + +Hi Alon, + +I'm curious, what kind of system are you testing this on? I'm trying to +load 100GB of data in our dbt3 workload on a 4-way itanium2. I'm +interested in the results you would expect. + +Mark + +From pgsql-performance-owner@postgresql.org Tue Jul 19 17:08:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 73B5B52A0D + for ; + Tue, 19 Jul 2005 17:08:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50859-04 + for ; + Tue, 19 Jul 2005 20:08:44 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) + by svr1.postgresql.org (Postfix) with ESMTP id ED0A952A04 + for ; + Tue, 19 Jul 2005 17:08:43 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i3so1303188wra + for ; + Tue, 19 Jul 2005 13:08:45 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=PIWUxpRgnErhtfEfneFNyuHwwUInsGpzJUt58vqaIr3TuY0/US0bv11mOoma8GjzBfF7DIZewc5yy7ixildx32uR0G54l3x5MmF0ibGufZLxo/g/hDopyfe1ZLbUeUp78DiDzWVxF9VRFEzZxp8ePAhZNJg9/ufOHD7YNjMtRTM= +Received: by 10.54.130.10 with SMTP id c10mr877747wrd; + Tue, 19 Jul 2005 13:08:11 -0700 (PDT) +Received: by 10.54.150.2 with HTTP; Tue, 19 Jul 2005 13:08:11 -0700 (PDT) +Message-ID: <1efd553a0507191308219a098b@mail.gmail.com> +Date: Tue, 19 Jul 2005 16:08:11 -0400 +From: Oliver Crosby +Reply-To: Oliver Crosby +To: Kevin Grittner +Subject: Re: Looking for tips +Cc: jd@commandprompt.com, pgsql-performance@postgresql.org +In-Reply-To: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.073 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/321 +X-Sequence-Number: 13562 + +> We had low resource utilization and poor throughput on inserts of +> thousands of rows within a single database transaction. There were a +> lot of configuration parameters we changed, but the one which helped the +> most was wal_buffers -- we wound up setting it to 1000. This may be +> higher than it needs to be, but when we got to something which ran well, +> we stopped tinkering. The default value clearly caused a bottleneck. + +I just tried wal_buffers =3D 1000, sort_mem at 10% and +effective_cache_size at 75%. +The performance refuses to budge.. I guess that's as good as it'll go? + +From pgsql-performance-owner@postgresql.org Tue Jul 19 17:19:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 63EB252A1F + for ; + Tue, 19 Jul 2005 17:19:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51777-06 + for ; + Tue, 19 Jul 2005 20:19:36 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 26B60529E6 + for ; + Tue, 19 Jul 2005 17:19:35 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id x7so1220119nzc + for ; + Tue, 19 Jul 2005 13:19:34 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=q2Ey2siL1V8GOLhFbg1BCPXEr7q/aHbEcICp04AcHljiDDlal3mqqL4gZy2GWCDqOv1Yj6YI8A4E37BKuz/3UkID0M2djHuelCbN6bb3x1BaOVqJglqZ8hR+uJ81s9Kg0XERJqMLZkoh0wj2SBQssYEtFCQcZv6mOJvWcv2cLys= +Received: by 10.36.141.3 with SMTP id o3mr5071734nzd; + Tue, 19 Jul 2005 13:19:04 -0700 (PDT) +Received: by 10.36.22.20 with HTTP; Tue, 19 Jul 2005 13:19:02 -0700 (PDT) +Message-ID: <758d5e7f0507191319636afaa3@mail.gmail.com> +Date: Tue, 19 Jul 2005 22:19:03 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: Oliver Crosby +Subject: Re: Looking for tips +Cc: Kevin Grittner , + jd@commandprompt.com, pgsql-performance@postgresql.org +In-Reply-To: <1efd553a0507191308219a098b@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <1efd553a0507191308219a098b@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.608 tagged_above=0 required=5 tests=AWL, + FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/322 +X-Sequence-Number: 13563 + +On 7/19/05, Oliver Crosby wrote: +> > We had low resource utilization and poor throughput on inserts of +> > thousands of rows within a single database transaction. There were a +> > lot of configuration parameters we changed, but the one which helped th= +e +> > most was wal_buffers -- we wound up setting it to 1000. This may be +> > higher than it needs to be, but when we got to something which ran well= +, +> > we stopped tinkering. The default value clearly caused a bottleneck. +>=20 +> I just tried wal_buffers =3D 1000, sort_mem at 10% and +> effective_cache_size at 75%. +> The performance refuses to budge.. I guess that's as good as it'll go? + +If it is possible try: +1) wrapping many inserts into one transaction +(BEGIN;INSERT;INSERT;...INSERT;COMMIT;). As PostgreSQL will need to +handle less transactions per second (each your insert is a transaction), it +may work faster. + +2) If you can do 1, you could go further and use a COPY command which is +the fastest way to bulk-load a database. + +Sometimes I insert data info temporary table, and then do: +INSERT INTO sometable SELECT * FROM tmp_table; +(but I do it when I want to do some select, updates, etc on +the data before "commiting" them to main table; dropping +temporary table is much cheaper than vacuuming many-a-row +table). + + Regards, + Dawid + +PS: Where can I find benchmarks comparing PHP vs Perl vs Python in +terms of speed of executing prepared statements? + +From pgsql-performance-owner@postgresql.org Tue Jul 19 17:29:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 12BBB52A9C + for ; + Tue, 19 Jul 2005 17:29:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56500-03 + for ; + Tue, 19 Jul 2005 20:29:01 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) + by svr1.postgresql.org (Postfix) with ESMTP id B54D852A88 + for ; + Tue, 19 Jul 2005 17:29:00 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i6so1314855wra + for ; + Tue, 19 Jul 2005 13:29:02 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=Xjq5mhzWZC3giOSDqH65tB7g4ue5ro9+tdul5/z81YAedYs2Y196iVqVGGKY5b4XgV56YBSN1ew1SmTtv69KijBsF/FgATPkrGOmmkTcDPdYYGLo5v7OXrUEHv053cGvvHbToFt+0vkCUXltcGdYOZg3HKQL6ZB//RC5znbxlrg= +Received: by 10.54.61.14 with SMTP id j14mr881742wra; + Tue, 19 Jul 2005 13:28:26 -0700 (PDT) +Received: by 10.54.150.2 with HTTP; Tue, 19 Jul 2005 13:28:26 -0700 (PDT) +Message-ID: <1efd553a050719132836c31b78@mail.gmail.com> +Date: Tue, 19 Jul 2005 16:28:26 -0400 +From: Oliver Crosby +Reply-To: Oliver Crosby +To: Dawid Kuroczko +Subject: Re: Looking for tips +Cc: Kevin Grittner , + jd@commandprompt.com, pgsql-performance@postgresql.org +In-Reply-To: <758d5e7f0507191319636afaa3@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <1efd553a0507191308219a098b@mail.gmail.com> + <758d5e7f0507191319636afaa3@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.066 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/324 +X-Sequence-Number: 13565 + +> If it is possible try: +> 1) wrapping many inserts into one transaction +> (BEGIN;INSERT;INSERT;...INSERT;COMMIT;). As PostgreSQL will need to +> handle less transactions per second (each your insert is a transaction), = +it +> may work faster. + +Aye, that's what I have it doing right now. The transactions do save a +HUGE chunk of time. (Cuts it down by about 40%). + +> 2) If you can do 1, you could go further and use a COPY command which is +> the fastest way to bulk-load a database. + +I don't think I can use COPY in my case because I need to do +processing on a per-line basis, and I need to check if the item I want +to insert is already there, and if it is, I need to get it's ID so I +can use that for further processing. + +From pgsql-performance-owner@postgresql.org Tue Jul 19 17:28:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B1ADF529C8 + for ; + Tue, 19 Jul 2005 17:28:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54420-06 + for ; + Tue, 19 Jul 2005 20:28:46 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 107EB5282F + for ; + Tue, 19 Jul 2005 17:28:45 -0300 (ADT) +Received: (qmail 24565 invoked from network); 19 Jul 2005 22:29:21 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 19 Jul 2005 22:29:21 +0200 +To: "Dawid Kuroczko" , + "Oliver Crosby" +Cc: "Kevin Grittner" , + jd@commandprompt.com, pgsql-performance@postgresql.org +Subject: Re: Looking for tips +References: + <1efd553a0507191308219a098b@mail.gmail.com> + <758d5e7f0507191319636afaa3@mail.gmail.com> +Message-ID: +Date: Tue, 19 Jul 2005 22:28:44 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <758d5e7f0507191319636afaa3@mail.gmail.com> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/323 +X-Sequence-Number: 13564 + + +> PS: Where can I find benchmarks comparing PHP vs Perl vs Python in +> terms of speed of executing prepared statements? + + I'm afraid you'll have to do these yourself ! + + And, I don't think the Python drivers support real prepared statements +(the speed of psycopy is really good though). + I don't think PHP either ; they don't even provide a database interface +to speak of (ie you have to build the query string by hand including +quoting). + + +From pgsql-performance-owner@postgresql.org Tue Jul 19 17:30:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CFDB25282F + for ; + Tue, 19 Jul 2005 17:30:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54368-09 + for ; + Tue, 19 Jul 2005 20:30:10 +0000 (GMT) +Received: from tektite.k12usa.com (tektite.k12hq.com [12.160.186.24]) + by svr1.postgresql.org (Postfix) with SMTP id BAB7852A90 + for ; + Tue, 19 Jul 2005 17:30:08 -0300 (ADT) +Received: (qmail 66476 invoked by uid 1001); 19 Jul 2005 20:30:04 -0000 +Date: Tue, 19 Jul 2005 16:30:04 -0400 +From: Christopher Weimann +To: Oliver Crosby +Cc: Richard Huxton , + pgsql-performance@postgresql.org +Subject: Re: Looking for tips +Message-ID: <20050719203004.GA4965@tektite.k12usa.internal> +References: <1efd553a05071910427b290203@mail.gmail.com> + <42DD420C.2010306@archonet.com> + <1efd553a05071911413e50ea90@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1efd553a05071911413e50ea90@mail.gmail.com> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/325 +X-Sequence-Number: 13566 + +On 07/19/2005-02:41PM, Oliver Crosby wrote: +> +> No queries in particular appear to be a problem. + +That could mean they are ALL a problem. Let see some EXPLAIN ANAYZE +results just to rule it out. + +> At the moment it's just one user, + +With 1 user PostgreSQL will probobaly never beat MySQL +but with hundreds it will. + + +From pgsql-performance-owner@postgresql.org Tue Jul 19 17:45:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 42C3852A88 + for ; + Tue, 19 Jul 2005 17:45:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61554-02 + for ; + Tue, 19 Jul 2005 20:45:04 +0000 (GMT) +Received: from smtp-gw-cl-c.dmv.com (smtp-gw-cl-c.dmv.com [216.240.97.41]) + by svr1.postgresql.org (Postfix) with ESMTP id 3770352A75 + for ; + Tue, 19 Jul 2005 17:45:02 -0300 (ADT) +Received: from lanshark.dmv.com (lanshark.dmv.com [216.240.97.46]) + by smtp-gw-cl-c.dmv.com (8.12.10/8.12.10) with ESMTP id j6JKivYY034048; + Tue, 19 Jul 2005 16:44:57 -0400 (EDT) (envelope-from sven@dmv.com) +Subject: Re: Looking for tips +From: Sven Willenberger +To: Oliver Crosby +Cc: Dawid Kuroczko , + Kevin Grittner , jd@commandprompt.com, + pgsql-performance@postgresql.org +In-Reply-To: <1efd553a050719132836c31b78@mail.gmail.com> +References: + <1efd553a0507191308219a098b@mail.gmail.com> + <758d5e7f0507191319636afaa3@mail.gmail.com> + <1efd553a050719132836c31b78@mail.gmail.com> +Content-Type: text/plain +Date: Tue, 19 Jul 2005 16:46:01 -0400 +Message-Id: <1121805961.3674.25.camel@lanshark.dmv.com> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 +Content-Transfer-Encoding: 7bit +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.327 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_WHOIS +X-Spam-Level: +X-Archive-Number: 200507/326 +X-Sequence-Number: 13567 + +On Tue, 2005-07-19 at 16:28 -0400, Oliver Crosby wrote: +> > If it is possible try: +> > 1) wrapping many inserts into one transaction +> > (BEGIN;INSERT;INSERT;...INSERT;COMMIT;). As PostgreSQL will need to +> > handle less transactions per second (each your insert is a transaction), it +> > may work faster. +> +> Aye, that's what I have it doing right now. The transactions do save a +> HUGE chunk of time. (Cuts it down by about 40%). +> +> > 2) If you can do 1, you could go further and use a COPY command which is +> > the fastest way to bulk-load a database. +> +> I don't think I can use COPY in my case because I need to do +> processing on a per-line basis, and I need to check if the item I want +> to insert is already there, and if it is, I need to get it's ID so I +> can use that for further processing. +> + +since triggers work with COPY, you could probably write a trigger that +looks for this condition and does the ID processsing you need; you could +thereby enjoy the enormous speed gain resulting from COPY and maintain +your data continuity. + +Sven + + +From pgsql-performance-owner@postgresql.org Tue Jul 19 18:04:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A160352A1F + for ; + Tue, 19 Jul 2005 18:04:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 64453-06 + for ; + Tue, 19 Jul 2005 21:04:43 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) + by svr1.postgresql.org (Postfix) with ESMTP id 3CC0D52A1B + for ; + Tue, 19 Jul 2005 18:04:42 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 37so1319439wra + for ; + Tue, 19 Jul 2005 14:04:44 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=MymnCGJhN6Bv75ENRG9Q+Mx6d8NLzAV0LS69KhL+S8rd3mCByjdOwVnTkH5sdkdydIwZpF4kvPdxFofU2bVJEIQVXbTvppSORwBdeE7vDOsK3SxnO4niQzbnwA+hvSzMZkjm1KVujB/3HzpA3XgzKM/Y77gNv6IA1z5pvWtUNts= +Received: by 10.54.137.17 with SMTP id k17mr892461wrd; + Tue, 19 Jul 2005 14:04:04 -0700 (PDT) +Received: by 10.54.150.2 with HTTP; Tue, 19 Jul 2005 14:04:04 -0700 (PDT) +Message-ID: <1efd553a050719140462d41468@mail.gmail.com> +Date: Tue, 19 Jul 2005 17:04:04 -0400 +From: Oliver Crosby +Reply-To: Oliver Crosby +To: Sven Willenberger +Subject: Re: Looking for tips +Cc: Dawid Kuroczko , + Kevin Grittner , jd@commandprompt.com, + pgsql-performance@postgresql.org +In-Reply-To: <1121805961.3674.25.camel@lanshark.dmv.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: + <1efd553a0507191308219a098b@mail.gmail.com> + <758d5e7f0507191319636afaa3@mail.gmail.com> + <1efd553a050719132836c31b78@mail.gmail.com> + <1121805961.3674.25.camel@lanshark.dmv.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.061 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/327 +X-Sequence-Number: 13568 + +> since triggers work with COPY, you could probably write a trigger that +> looks for this condition and does the ID processsing you need; you could +> thereby enjoy the enormous speed gain resulting from COPY and maintain +> your data continuity. + +So... (bear with me here.. trying to make sense of this).. +With triggers there's a way I can do the parsing I need to on a log +file and react to completed events in non-sequential order (you can +ignore that part.. it's just how we piece together different related +events) and then have perl/DBD::Pg invoke a copy command (which, from +what I can tell, has to operate on a file...) and the copy command can +feed the ID I need back to perl so I can work with it... +If that doesn't hurt my brain, then I'm at least kinda confused... +Anyway. Heading home now. I'll think about this more tonight/tomorrow. + +From pgsql-patches-owner@postgresql.org Tue Jul 19 18:06:18 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4DF795280C + for ; + Tue, 19 Jul 2005 18:06:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59079-09 + for ; + Tue, 19 Jul 2005 21:06:05 +0000 (GMT) +Received: from mail.Mi8.com (mail.mi8.com [63.240.6.41]) + by svr1.postgresql.org (Postfix) with ESMTP id 2E9A152A1F + for ; + Tue, 19 Jul 2005 18:06:03 -0300 (ADT) +Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- GW01 Welcome + to Mi8 Corporation www.Mi8.com); Tue, 19 Jul 2005 17:05:55 -0400 +X-Server-Uuid: F1A2E19A-84E4-48DD-8F48-B475613F58B2 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 19 Jul + 2005 17:05:55 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 19 Jul + 2005 17:05:54 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Tue, 19 Jul 2005 14:05:56 -0700 +Subject: Re: COPY FROM performance improvements +From: "Alon Goldshuv" +To: "Mark Wong" +Cc: pgsql-patches@postgresql.org +Message-ID: +In-Reply-To: <200507191954.j6JJsVjA003280@smtp.osdl.org> +MIME-Version: 1.0 +X-OriginalArrivalTime: 19 Jul 2005 21:05:55.0052 (UTC) + FILETIME=[A713EAC0:01C58CA5] +X-WSS-ID: 6EC3B4B91J47477295-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, hits=1.598 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/384 +X-Sequence-Number: 16724 + +Hi Mark, + +I improved the data *parsing* capabilities of COPY, and didn't touch the +data conversion or data insertion parts of the code. The parsing improvement +will vary largely depending on the ratio of parsing -to- converting and +inserting. + +Therefore, the speed increase really depends on the nature of your data: + +100GB file with +long data rows (lots of parsing) +Small number of columns (small number of attr conversions per row) +less rows (less tuple insertions) + +Will show the best performance improvements. + +However, same file size 100GB with +Short data rows (minimal parsing) +large number of columns (large number of attr conversions per row) +AND/OR +more rows (more tuple insertions) + +Will show improvements but not as significant. +In general I'll estimate 40%-95% improvement in load speed for the 1st case +and 10%-40% for the 2nd. But that also depends on the hardware, disk speed +etc... This is for TEXT format. As for CSV, it may be faster but not as much +as I specified here. BINARY will stay the same as before. + +HTH +Alon. + + + + + + +On 7/19/05 12:54 PM, "Mark Wong" wrote: + +> On Thu, 14 Jul 2005 17:22:18 -0700 +> "Alon Goldshuv" wrote: +> +>> I revisited my patch and removed the code duplications that were there, and +>> added support for CSV with buffered input, so CSV now runs faster too +>> (although it is not as optimized as the TEXT format parsing). So now +>> TEXT,CSV and BINARY are all parsed in CopyFrom(), like in the original file. +> +> Hi Alon, +> +> I'm curious, what kind of system are you testing this on? I'm trying to +> load 100GB of data in our dbt3 workload on a 4-way itanium2. I'm +> interested in the results you would expect. +> +> Mark +> + + + +From pgsql-performance-owner@postgresql.org Tue Jul 19 18:06:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8AB6552A4B + for ; + Tue, 19 Jul 2005 18:06:04 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63749-08 + for ; + Tue, 19 Jul 2005 21:06:01 +0000 (GMT) +Received: from calvin.surfutopia.net (calvin.surfutopia.net [67.120.245.34]) + by svr1.postgresql.org (Postfix) with ESMTP id CA55C52A2F + for ; + Tue, 19 Jul 2005 18:05:59 -0300 (ADT) +Received: by calvin.surfutopia.net (Postfix, from userid 1000) + id 5839FF23A; Tue, 19 Jul 2005 14:05:57 -0700 (PDT) +Date: Tue, 19 Jul 2005 14:05:57 -0700 +From: John Mendenhall +To: pgsql-performance list +Subject: performance decrease after reboot +Message-ID: <20050719210557.GA30794@calvin.surfutopia.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/328 +X-Sequence-Number: 13569 + +I tuned a query last week to obtain acceptable performance. +Here is my recorded explain analyze results: + +----- +LOG: duration: 826.505 ms statement: explain analyze + SELECT + c.id AS contact_id, + sr.id AS sales_rep_id, + LTRIM(RTRIM(sr.firstname || ' ' || sr.lastname)) AS sales_rep_name, + p.id AS partner_id, + p.company AS partner_company, + coalesce(LTRIM(RTRIM(c.company)), LTRIM(RTRIM(c.firstname || ' ' || c.lastname))) + AS contact_company, + LTRIM(RTRIM(c.city || ' ' || c.state || ' ' || c.postalcode || ' ' || c.country)) + AS contact_location, + c.phone AS contact_phone, + c.email AS contact_email, + co.name AS contact_country, + TO_CHAR(c.request_status_last_modified, 'mm/dd/yy hh12:mi pm') + AS request_status_last_modified, + TO_CHAR(c.request_status_last_modified, 'yyyymmddhh24miss') + AS rqst_stat_last_mdfd_sortable, + c.token_id + FROM + sales_reps sr + JOIN partners p ON (sr.id = p.sales_rep_id) + JOIN contacts c ON (p.id = c.partner_id) + JOIN countries co ON (LOWER(c.country) = LOWER(co.code)) + JOIN partner_classification pc ON (p.classification_id = pc.id AND pc.classification != 'Sales Rep') + WHERE + c.lead_deleted IS NULL + AND EXISTS + ( + SELECT + lr.id + FROM + lead_requests lr, + lead_request_status lrs + WHERE + c.id = lr.contact_id AND + lr.status_id = lrs.id AND + lrs.is_closed = 0 + ) + ORDER BY + contact_company, contact_id +QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- + Sort (cost=18266.77..18266.80 rows=11 width=219) (actual time=795.502..795.763 rows=246 loops=1) + Sort Key: COALESCE(ltrim(rtrim((c.company)::text)), ltrim(rtrim((((c.firstname)::text || ' '::text) || (c.lastname)::text)))), c.id + -> Hash Join (cost=18258.48..18266.58 rows=11 width=219) (actual time=747.551..788.095 rows=246 loops=1) + Hash Cond: (lower(("outer".code)::text) = lower(("inner".country)::text)) + -> Seq Scan on countries co (cost=0.00..4.42 rows=242 width=19) (actual time=0.040..2.128 rows=242 loops=1) + -> Hash (cost=18258.45..18258.45 rows=9 width=206) (actual time=746.653..746.653 rows=0 loops=1) + -> Merge Join (cost=18258.12..18258.45 rows=9 width=206) (actual time=729.412..743.691 rows=246 loops=1) + Merge Cond: ("outer".sales_rep_id = "inner".id) + -> Sort (cost=18255.70..18255.73 rows=9 width=185) (actual time=727.948..728.274 rows=249 loops=1) + Sort Key: p.sales_rep_id + -> Merge Join (cost=18255.39..18255.56 rows=9 width=185) (actual time=712.747..723.095 rows=249 loops=1) + Merge Cond: ("outer".id = "inner".classification_id) + -> Sort (cost=1.05..1.05 rows=2 width=10) (actual time=0.192..0.195 rows=2 loops=1) + Sort Key: pc.id + -> Seq Scan on partner_classification pc (cost=0.00..1.04 rows=2 width=10) (actual time=0.100..0.142 rows=2 loops=1) + Filter: ((classification)::text <> 'Sales Rep'::text) + -> Sort (cost=18254.35..18254.38 rows=13 width=195) (actual time=712.401..712.675 rows=250 loops=1) + Sort Key: p.classification_id + -> Merge Join (cost=0.00..18254.11 rows=13 width=195) (actual time=47.844..705.517 rows=448 loops=1) + Merge Cond: ("outer".id = "inner".partner_id) + -> Index Scan using partners_pkey on partners p (cost=0.00..30.80 rows=395 width=53) (actual time=0.066..5.746 rows=395 loops=1) + -> Index Scan using contacts_partner_id_idx on contacts c (cost=0.00..130358.50 rows=93 width=152) (actual time=0.351..662.576 rows=452 loops=1) + Filter: ((lead_deleted IS NULL) AND (subplan)) + SubPlan + -> Nested Loop (cost=0.00..6.76 rows=2 width=10) (actual time=0.094..0.094 rows=0 loops=5573) + Join Filter: ("outer".status_id = "inner".id) + -> Index Scan using lead_requests_contact_id_idx on lead_requests lr (cost=0.00..4.23 rows=2 width=20) (actual time=0.068..0.069 rows=0 loops=5573) + Index Cond: ($0 = contact_id) + -> Seq Scan on lead_request_status lrs (cost=0.00..1.16 rows=8 width=10) (actual time=0.030..0.094 rows=4 loops=519) + Filter: (is_closed = 0::numeric) + -> Sort (cost=2.42..2.52 rows=39 width=31) (actual time=1.334..1.665 rows=267 loops=1) + Sort Key: sr.id + -> Seq Scan on sales_reps sr (cost=0.00..1.39 rows=39 width=31) (actual time=0.064..0.533 rows=39 loops=1) + Total runtime: 798.494 ms +(34 rows) +----- + +I rebooted the database machine later that night. +Now, when I run the same query, I get the following +results: + +----- +QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- + Sort (cost=17415.32..17415.35 rows=11 width=219) (actual time=6880.583..6880.738 rows=246 loops=1) + Sort Key: COALESCE(ltrim(rtrim((c.company)::text)), ltrim(rtrim((((c.firstname)::text || ' '::text) || (c.lastname)::text)))), c.id + -> Merge Join (cost=17414.22..17415.13 rows=11 width=219) (actual time=6828.441..6871.894 rows=246 loops=1) + Merge Cond: ("outer".sales_rep_id = "inner".id) + -> Sort (cost=17411.80..17411.83 rows=11 width=198) (actual time=6825.227..6825.652 rows=249 loops=1) + Sort Key: p.sales_rep_id + -> Merge Join (cost=17411.42..17411.61 rows=11 width=198) (actual time=6805.894..6818.717 rows=249 loops=1) + Merge Cond: ("outer".id = "inner".classification_id) + -> Sort (cost=1.05..1.05 rows=2 width=10) (actual time=0.788..0.792 rows=2 loops=1) + Sort Key: pc.id + -> Seq Scan on partner_classification pc (cost=0.00..1.04 rows=2 width=10) (actual time=0.094..0.554 rows=2 loops=1) + Filter: ((classification)::text <> 'Sales Rep'::text) + -> Sort (cost=17410.38..17410.41 rows=15 width=208) (actual time=6804.649..6804.923 rows=250 loops=1) + Sort Key: p.classification_id + -> Merge Join (cost=4.42..17410.08 rows=15 width=208) (actual time=62.598..6795.704 rows=448 loops=1) + Merge Cond: ("outer".partner_id = "inner".id) + -> Nested Loop (cost=4.42..130886.19 rows=113 width=165) (actual time=8.807..6712.529 rows=739 loops=1) + Join Filter: (lower(("outer".country)::text) = lower(("inner".code)::text)) + -> Index Scan using contacts_partner_id_idx on contacts c (cost=0.00..130206.59 rows=93 width=152) (actual time=0.793..4082.343 rows=739 loops=1) + Filter: ((lead_deleted IS NULL) AND (subplan)) + SubPlan + -> Nested Loop (cost=0.00..6.76 rows=2 width=10) (actual time=0.084..0.084 rows=0 loops=37077) + Join Filter: ("outer".status_id = "inner".id) + -> Index Scan using lead_requests_contact_id_idx on lead_requests lr (cost=0.00..4.23 rows=2 width=20) (actual time=0.066..0.066 rows=0 loops=37077) + Index Cond: ($0 = contact_id) + -> Seq Scan on lead_request_status lrs (cost=0.00..1.16 rows=8 width=10) (actual time=0.031..0.140 rows=4 loops=1195) + Filter: (is_closed = 0::numeric) + -> Materialize (cost=4.42..6.84 rows=242 width=19) (actual time=0.003..0.347 rows=242 loops=739) + -> Seq Scan on countries co (cost=0.00..4.42 rows=242 width=19) (actual time=0.038..3.162 rows=242 loops=1) + -> Index Scan using partners_pkey on partners p (cost=0.00..30.80 rows=395 width=53) (actual time=0.062..15.152 rows=787 loops=1) + -> Sort (cost=2.42..2.52 rows=39 width=31) (actual time=1.916..2.723 rows=267 loops=1) + Sort Key: sr.id + -> Seq Scan on sales_reps sr (cost=0.00..1.39 rows=39 width=31) (actual time=0.065..0.723 rows=39 loops=1) + Total runtime: 6886.307 ms +(34 rows) +----- + +There is definitely a difference in the query plans. +I am guessing this difference in the performance decrease. +However, nothing was changed in the postgresql.conf file. +I may have run something in the psql explain analyze session +a week ago, but I can't figure out what I changed. + +So, the bottom line is this: + +What do I need to do to get back to the better performance? +Is it possible to determine what options may have changed from +the above query plan differences? + +And, also, + +What is the "Materialize" query plan item in the second +query plan, the slower plan? + +If you need any additional configurations, please let me +know. + +Thank you very much in advance for any pointers you can +provide. + +JohnM + +-- +John Mendenhall +john@surfutopia.net +surf utopia +internet services + +From pgsql-performance-owner@postgresql.org Tue Jul 19 18:14:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BFEAB529AE + for ; + Tue, 19 Jul 2005 18:14:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 64009-06 + for ; + Tue, 19 Jul 2005 21:14:05 +0000 (GMT) +Received: from smtp-gw-cl-c.dmv.com (smtp-gw-cl-c.dmv.com [216.240.97.41]) + by svr1.postgresql.org (Postfix) with ESMTP id 943215280C + for ; + Tue, 19 Jul 2005 18:14:03 -0300 (ADT) +Received: from lanshark.dmv.com (lanshark.dmv.com [216.240.97.46]) + by smtp-gw-cl-c.dmv.com (8.12.10/8.12.10) with ESMTP id j6JLE4YY035074; + Tue, 19 Jul 2005 17:14:04 -0400 (EDT) (envelope-from sven@dmv.com) +Subject: Re: Looking for tips +From: Sven Willenberger +To: Oliver Crosby +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1efd553a050719140462d41468@mail.gmail.com> +References: + <1efd553a0507191308219a098b@mail.gmail.com> + <758d5e7f0507191319636afaa3@mail.gmail.com> + <1efd553a050719132836c31b78@mail.gmail.com> + <1121805961.3674.25.camel@lanshark.dmv.com> + <1efd553a050719140462d41468@mail.gmail.com> +Content-Type: text/plain +Date: Tue, 19 Jul 2005 17:15:08 -0400 +Message-Id: <1121807708.3673.47.camel@lanshark.dmv.com> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 +Content-Transfer-Encoding: 7bit +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.328 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_WHOIS +X-Spam-Level: +X-Archive-Number: 200507/329 +X-Sequence-Number: 13570 + +On Tue, 2005-07-19 at 17:04 -0400, Oliver Crosby wrote: +> > since triggers work with COPY, you could probably write a trigger that +> > looks for this condition and does the ID processsing you need; you could +> > thereby enjoy the enormous speed gain resulting from COPY and maintain +> > your data continuity. +> +> So... (bear with me here.. trying to make sense of this).. +> With triggers there's a way I can do the parsing I need to on a log +> file and react to completed events in non-sequential order (you can +> ignore that part.. it's just how we piece together different related +> events) and then have perl/DBD::Pg invoke a copy command (which, from +> what I can tell, has to operate on a file...) and the copy command can +> feed the ID I need back to perl so I can work with it... +> If that doesn't hurt my brain, then I'm at least kinda confused... +> Anyway. Heading home now. I'll think about this more tonight/tomorrow. +> + +Well without knowing the specifics of what you are actually trying to +accomplish I cannot say yes or no to your question. I am not sure from +where this data is coming that you are inserting into the db. However, +if the scenario is this: a) attempt to insert a row b) if row exists +already, grab the ID and do other db selects/inserts/deletes based on +that ID, then there is no need to feed this information back to the +perlscript. Is your perlscript parsing a file and then using the parsed +information to insert rows? If so, how is the ID that is returned used? +Can you have the trigger use the ID that may be returned to perform +whatever it is that your perlscript is trying to accomplish with that +ID? + +It's all kind of vague so my answers may or may not help, but based on +the [lack of] specifics you have provided, I fear that is the best +suggestion that I can offer at this point. + +Sven + + +From pgsql-patches-owner@postgresql.org Tue Jul 19 18:37:43 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E489529A0 + for ; + Tue, 19 Jul 2005 18:37:39 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69413-09 + for ; + Tue, 19 Jul 2005 21:37:36 +0000 (GMT) +Received: from smtp.osdl.org (smtp.osdl.org [65.172.181.4]) + by svr1.postgresql.org (Postfix) with ESMTP id 4FDAC52989 + for ; + Tue, 19 Jul 2005 18:37:35 -0300 (ADT) +Received: from ibm-b.pdx.osdl.net (fw.osdl.org [65.172.181.6]) + (authenticated bits=0) + by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j6JLbZjA011011 + (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); + Tue, 19 Jul 2005 14:37:36 -0700 +Message-Id: <200507192137.j6JLbZjA011011@smtp.osdl.org> +Date: Tue, 19 Jul 2005 14:37:58 -0700 +From: Mark Wong +To: "Alon Goldshuv" +Cc: pgsql-patches@postgresql.org +Subject: Re: COPY FROM performance improvements +In-Reply-To: +References: <200507191954.j6JJsVjA003280@smtp.osdl.org> + +Organization: OSDL +X-Mailer: Sylpheed-Claws 1.0.4a (GTK+ 1.2.10; i686-pc-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-MIMEDefang-Filter: osdl$Revision: 1.113 $ +X-Scanned-By: MIMEDefang 2.36 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/386 +X-Sequence-Number: 16726 + +Hi Alon, + +Yeah, that helps. I just need to break up my scripts a little to just +load the data and not build indexes. + +Is the following information good enough to give a guess about the data +I'm loading, if you don't mind? ;) Here's a link to my script to create +tables: +http://developer.osdl.org/markw/mt/getfile.py?id=eaf16b7831588729780645b2bb44f7f23437e432&path=scripts/pgsql/create_tables.sh.in + +File sizes: +-rw-r--r-- 1 markw 50 2.3G Jul 8 15:03 customer.tbl +-rw-r--r-- 1 markw 50 74G Jul 8 15:03 lineitem.tbl +-rw-r--r-- 1 markw 50 2.1K Jul 8 15:03 nation.tbl +-rw-r--r-- 1 markw 50 17G Jul 8 15:03 orders.tbl +-rw-r--r-- 1 markw 50 2.3G Jul 8 15:03 part.tbl +-rw-r--r-- 1 markw 50 12G Jul 8 15:03 partsupp.tbl +-rw-r--r-- 1 markw 50 391 Jul 8 15:03 region.tbl +-rw-r--r-- 1 markw 50 136M Jul 8 15:03 supplier.tbl + +Number of rows: +# wc -l *.tbl + 15000000 customer.tbl + 600037902 lineitem.tbl + 25 nation.tbl + 150000000 orders.tbl + 20000000 part.tbl + 80000000 partsupp.tbl + 5 region.tbl + 1000000 supplier.tbl + +Thanks, +Mark + +On Tue, 19 Jul 2005 14:05:56 -0700 +"Alon Goldshuv" wrote: + +> Hi Mark, +> +> I improved the data *parsing* capabilities of COPY, and didn't touch the +> data conversion or data insertion parts of the code. The parsing improvement +> will vary largely depending on the ratio of parsing -to- converting and +> inserting. +> +> Therefore, the speed increase really depends on the nature of your data: +> +> 100GB file with +> long data rows (lots of parsing) +> Small number of columns (small number of attr conversions per row) +> less rows (less tuple insertions) +> +> Will show the best performance improvements. +> +> However, same file size 100GB with +> Short data rows (minimal parsing) +> large number of columns (large number of attr conversions per row) +> AND/OR +> more rows (more tuple insertions) +> +> Will show improvements but not as significant. +> In general I'll estimate 40%-95% improvement in load speed for the 1st case +> and 10%-40% for the 2nd. But that also depends on the hardware, disk speed +> etc... This is for TEXT format. As for CSV, it may be faster but not as much +> as I specified here. BINARY will stay the same as before. +> +> HTH +> Alon. +> +> +> +> +> +> +> On 7/19/05 12:54 PM, "Mark Wong" wrote: +> +> > On Thu, 14 Jul 2005 17:22:18 -0700 +> > "Alon Goldshuv" wrote: +> > +> >> I revisited my patch and removed the code duplications that were there, and +> >> added support for CSV with buffered input, so CSV now runs faster too +> >> (although it is not as optimized as the TEXT format parsing). So now +> >> TEXT,CSV and BINARY are all parsed in CopyFrom(), like in the original file. +> > +> > Hi Alon, +> > +> > I'm curious, what kind of system are you testing this on? I'm trying to +> > load 100GB of data in our dbt3 workload on a 4-way itanium2. I'm +> > interested in the results you would expect. +> > +> > Mark +> > +> + +From pgsql-performance-owner@postgresql.org Tue Jul 19 18:41:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 59ADA5298F + for ; + Tue, 19 Jul 2005 18:41:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73838-02 + for ; + Tue, 19 Jul 2005 21:41:23 +0000 (GMT) +Received: from netbox.unitech.com.ar (unknown [200.32.92.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 3418752989 + for ; + Tue, 19 Jul 2005 18:41:18 -0300 (ADT) +Received: from dariop (dariop.unitech.com.ar [192.168.1.237]) + by netbox.unitech.com.ar (8.11.6/8.11.6) with ESMTP id j6JMfZE00423 + for ; Tue, 19 Jul 2005 18:41:36 -0400 +Received: from 127.0.0.1 (AVG SMTP 7.0.323 [267.9.1]); + Tue, 19 Jul 2005 18:41:18 -0300 +From: "Dario" +To: +Subject: Re: join and query planner +Date: Tue, 19 Jul 2005 18:41:18 -0300 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="US-ASCII" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 +Importance: Normal +In-Reply-To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.092 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/330 +X-Sequence-Number: 13571 + +I'll try that. + +Let you know as soon as I can take a look. + + +Thank you- + +-----Mensaje original----- +De: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org]En nombre de Kevin +Grittner +Enviado el: lunes, 18 de julio de 2005 17:48 +Para: pgsql-performance@postgresql.org; dario_d_s@unitech.com.ar +Asunto: Re: [PERFORM] join and query planner + + +You might want to set join_collapse_limit high, and use the JOIN +operators rather than the comma-separated lists. We generate the WHERE +clause on the fly, based on user input, and this has worked well for us. + +-Kevin + + +>>> "Dario" 07/18/05 2:24 PM >>> +Hi. + +> Just out of curiosity, does it do any better with the following? +> +> SELECT ... + +Yes, it does. + +But my query could also be + SELECT ... + FROM a + JOIN b ON (a.key = b.key) + LEFT JOIN c ON (c.key = a.key) + LEFT JOIN d ON (d.key=a.key) +/*new*/ , e + WHERE (b.column <= 100) +/*new*/ and (e.key = a.key) and (e.field = 'filter') + +because it's constructed by an application. I needed to know if, +somehow, +someway, I can "unforce" join order. +The only way to solve it so far is changing application. It must build +something like + + SELECT ... + FROM b + JOIN (a JOIN e ON (e.key = a.key)) ON (a.key = b.key) + LEFT JOIN c ON (c.key = a.key) + LEFT JOIN d ON (d.key=a.key) + WHERE (b.column <= 100) and (e.field = 'filter') + +Supossed that e.field has (should have) better selectivity. But now this +problem belongs to programmer's group :-) + +The query, in fact, has more tables to join. I wonder if lowering geqo +threshold could do the work... + +Thank you. Greetings. Long life, little spam and prosperity! + + +-----Mensaje original----- +De: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org]En nombre de Kevin +Grittner +Enviado el: lunes, 18 de julio de 2005 14:58 +Para: pgsql-performance@postgresql.org; dariop@unitech.com.ar +Asunto: Re: [PERFORM] join and query planner + + +Just out of curiosity, does it do any better with the following? + + SELECT ... + FROM a + JOIN b ON (a.key = b.key) + LEFT JOIN c ON (c.key = a.key) + LEFT JOIN d ON (d.key=a.key) + WHERE (b.column <= 100) + + +>>> snipp + + +---------------------------(end of broadcast)--------------------------- +TIP 5: don't forget to increase your free space map settings + + +---------------------------(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-patches-owner@postgresql.org Tue Jul 19 19:06:47 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E9F252989 + for ; + Tue, 19 Jul 2005 19:06:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75085-10 + for ; + Tue, 19 Jul 2005 22:06:35 +0000 (GMT) +Received: from mail.Mi8.com (nycgw05.mi8.com [63.240.6.50]) + by svr1.postgresql.org (Postfix) with ESMTP id B6527529B6 + for ; + Tue, 19 Jul 2005 19:06:24 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- GW05 Welcome + to Mi8 Corporation www.Mi8.com); Tue, 19 Jul 2005 18:06:16 -0400 +X-Server-Uuid: E0C866E6-C6CD-48B5-AE61-E57E73CF3CC7 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 19 Jul + 2005 18:06:16 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 19 Jul + 2005 18:06:14 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Tue, 19 Jul 2005 15:06:17 -0700 +Subject: Re: COPY FROM performance improvements +From: "Alon Goldshuv" +To: "Mark Wong" +Cc: pgsql-patches@postgresql.org +Message-ID: +In-Reply-To: <200507192137.j6JLbZjA011011@smtp.osdl.org> +MIME-Version: 1.0 +X-OriginalArrivalTime: 19 Jul 2005 22:06:16.0572 (UTC) + FILETIME=[15AC03C0:01C58CAE] +X-WSS-ID: 6EC3A6D21M87483625-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, hits=1.595 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/388 +X-Sequence-Number: 16728 + +Mark, + +Thanks for the info. + +Yes, isolating indexes out of the picture is a good idea for this purpose. + +I can't really give a guess to how fast the load rate should be. I don't +know how your system is configured, and all the hardware characteristics +(and even if I knew that info I may not be able to guess...). I am pretty +confident that the load will be faster than before, I'll risk that ;-) +Looking into your TPC-H size and metadata I'll estimate that +partsupp,customer and orders will have the most significant increase in load +rate. You could start with those. + +I guess the only way to really know is to try... Load several times with the +existing PG-COPY and then load several times with the patched COPY and +compare. I'll be curious to hear your results. + +Thx, +Alon. + + + + +On 7/19/05 2:37 PM, "Mark Wong" wrote: + +> Hi Alon, +> +> Yeah, that helps. I just need to break up my scripts a little to just +> load the data and not build indexes. +> +> Is the following information good enough to give a guess about the data +> I'm loading, if you don't mind? ;) Here's a link to my script to create +> tables: +> http://developer.osdl.org/markw/mt/getfile.py?id=eaf16b7831588729780645b2bb44f +> 7f23437e432&path=scripts/pgsql/create_tables.sh.in +> +> File sizes: +> -rw-r--r-- 1 markw 50 2.3G Jul 8 15:03 customer.tbl +> -rw-r--r-- 1 markw 50 74G Jul 8 15:03 lineitem.tbl +> -rw-r--r-- 1 markw 50 2.1K Jul 8 15:03 nation.tbl +> -rw-r--r-- 1 markw 50 17G Jul 8 15:03 orders.tbl +> -rw-r--r-- 1 markw 50 2.3G Jul 8 15:03 part.tbl +> -rw-r--r-- 1 markw 50 12G Jul 8 15:03 partsupp.tbl +> -rw-r--r-- 1 markw 50 391 Jul 8 15:03 region.tbl +> -rw-r--r-- 1 markw 50 136M Jul 8 15:03 supplier.tbl +> +> Number of rows: +> # wc -l *.tbl +> 15000000 customer.tbl +> 600037902 lineitem.tbl +> 25 nation.tbl +> 150000000 orders.tbl +> 20000000 part.tbl +> 80000000 partsupp.tbl +> 5 region.tbl +> 1000000 supplier.tbl +> +> Thanks, +> Mark +> +> On Tue, 19 Jul 2005 14:05:56 -0700 +> "Alon Goldshuv" wrote: +> +>> Hi Mark, +>> +>> I improved the data *parsing* capabilities of COPY, and didn't touch the +>> data conversion or data insertion parts of the code. The parsing improvement +>> will vary largely depending on the ratio of parsing -to- converting and +>> inserting. +>> +>> Therefore, the speed increase really depends on the nature of your data: +>> +>> 100GB file with +>> long data rows (lots of parsing) +>> Small number of columns (small number of attr conversions per row) +>> less rows (less tuple insertions) +>> +>> Will show the best performance improvements. +>> +>> However, same file size 100GB with +>> Short data rows (minimal parsing) +>> large number of columns (large number of attr conversions per row) +>> AND/OR +>> more rows (more tuple insertions) +>> +>> Will show improvements but not as significant. +>> In general I'll estimate 40%-95% improvement in load speed for the 1st case +>> and 10%-40% for the 2nd. But that also depends on the hardware, disk speed +>> etc... This is for TEXT format. As for CSV, it may be faster but not as much +>> as I specified here. BINARY will stay the same as before. +>> +>> HTH +>> Alon. +>> +>> +>> +>> +>> +>> +>> On 7/19/05 12:54 PM, "Mark Wong" wrote: +>> +>>> On Thu, 14 Jul 2005 17:22:18 -0700 +>>> "Alon Goldshuv" wrote: +>>> +>>>> I revisited my patch and removed the code duplications that were there, and +>>>> added support for CSV with buffered input, so CSV now runs faster too +>>>> (although it is not as optimized as the TEXT format parsing). So now +>>>> TEXT,CSV and BINARY are all parsed in CopyFrom(), like in the original +>>>> file. +>>> +>>> Hi Alon, +>>> +>>> I'm curious, what kind of system are you testing this on? I'm trying to +>>> load 100GB of data in our dbt3 workload on a 4-way itanium2. I'm +>>> interested in the results you would expect. +>>> +>>> Mark +>>> +>> +> + + + +From pgsql-patches-owner@postgresql.org Tue Jul 19 19:18:16 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2B53052815 + for ; + Tue, 19 Jul 2005 19:18:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 78923-04 + for ; + Tue, 19 Jul 2005 22:18:05 +0000 (GMT) +Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) + by svr1.postgresql.org (Postfix) with ESMTP id 2624552869 + for ; + Tue, 19 Jul 2005 19:18:02 -0300 (ADT) +Received: from [192.168.1.103] (cpe-024-211-165-134.nc.res.rr.com + [24.211.165.134]) (authenticated (0 bits)) + by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id j6JLWO512530; + Tue, 19 Jul 2005 16:32:24 -0500 +Message-ID: <42DD7C10.4090008@dunslane.net> +Date: Tue, 19 Jul 2005 18:17:52 -0400 +From: Andrew Dunstan +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.8) Gecko/20050513 Fedora/1.7.8-1.3.1 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Mark Wong +Cc: Alon Goldshuv , + pgsql-patches@postgresql.org +Subject: Re: COPY FROM performance improvements +References: <200507191954.j6JJsVjA003280@smtp.osdl.org> + + <200507192137.j6JLbZjA011011@smtp.osdl.org> +In-Reply-To: <200507192137.j6JLbZjA011011@smtp.osdl.org> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/389 +X-Sequence-Number: 16729 + +Mark, + +You should definitely not be doing this sort of thing, I believe: + +CREATE TABLE orders ( + o_orderkey INTEGER, + o_custkey INTEGER, + o_orderstatus CHAR(1), + o_totalprice REAL, + o_orderDATE DATE, + o_orderpriority CHAR(15), + o_clerk CHAR(15), + o_shippriority INTEGER, + o_comment VARCHAR(79), + PRIMARY KEY (o_orderkey)) + +Create the table with no constraints, load the data, then set up primary keys and whatever other constraints you want using ALTER TABLE. Last time I did a load like this (albeit 2 orders of magnitude smaller) I saw a 50% speedup from deferring constarint creation. + + +cheers + +andrew + + + +Mark Wong wrote: + +>Hi Alon, +> +>Yeah, that helps. I just need to break up my scripts a little to just +>load the data and not build indexes. +> +>Is the following information good enough to give a guess about the data +>I'm loading, if you don't mind? ;) Here's a link to my script to create +>tables: +>http://developer.osdl.org/markw/mt/getfile.py?id=eaf16b7831588729780645b2bb44f7f23437e432&path=scripts/pgsql/create_tables.sh.in +> +>File sizes: +>-rw-r--r-- 1 markw 50 2.3G Jul 8 15:03 customer.tbl +>-rw-r--r-- 1 markw 50 74G Jul 8 15:03 lineitem.tbl +>-rw-r--r-- 1 markw 50 2.1K Jul 8 15:03 nation.tbl +>-rw-r--r-- 1 markw 50 17G Jul 8 15:03 orders.tbl +>-rw-r--r-- 1 markw 50 2.3G Jul 8 15:03 part.tbl +>-rw-r--r-- 1 markw 50 12G Jul 8 15:03 partsupp.tbl +>-rw-r--r-- 1 markw 50 391 Jul 8 15:03 region.tbl +>-rw-r--r-- 1 markw 50 136M Jul 8 15:03 supplier.tbl +> +>Number of rows: +># wc -l *.tbl +> 15000000 customer.tbl +> 600037902 lineitem.tbl +> 25 nation.tbl +> 150000000 orders.tbl +> 20000000 part.tbl +> 80000000 partsupp.tbl +> 5 region.tbl +> 1000000 supplier.tbl +> +>Thanks, +>Mark +> +>On Tue, 19 Jul 2005 14:05:56 -0700 +>"Alon Goldshuv" wrote: +> +> +> +>>Hi Mark, +>> +>>I improved the data *parsing* capabilities of COPY, and didn't touch the +>>data conversion or data insertion parts of the code. The parsing improvement +>>will vary largely depending on the ratio of parsing -to- converting and +>>inserting. +>> +>>Therefore, the speed increase really depends on the nature of your data: +>> +>>100GB file with +>>long data rows (lots of parsing) +>>Small number of columns (small number of attr conversions per row) +>>less rows (less tuple insertions) +>> +>>Will show the best performance improvements. +>> +>>However, same file size 100GB with +>>Short data rows (minimal parsing) +>>large number of columns (large number of attr conversions per row) +>>AND/OR +>>more rows (more tuple insertions) +>> +>>Will show improvements but not as significant. +>>In general I'll estimate 40%-95% improvement in load speed for the 1st case +>>and 10%-40% for the 2nd. But that also depends on the hardware, disk speed +>>etc... This is for TEXT format. As for CSV, it may be faster but not as much +>>as I specified here. BINARY will stay the same as before. +>> +>>HTH +>>Alon. +>> +>> +>> +>> +>> +>> +>>On 7/19/05 12:54 PM, "Mark Wong" wrote: +>> +>> +>> +>>>On Thu, 14 Jul 2005 17:22:18 -0700 +>>>"Alon Goldshuv" wrote: +>>> +>>> +>>> +>>>>I revisited my patch and removed the code duplications that were there, and +>>>>added support for CSV with buffered input, so CSV now runs faster too +>>>>(although it is not as optimized as the TEXT format parsing). So now +>>>>TEXT,CSV and BINARY are all parsed in CopyFrom(), like in the original file. +>>>> +>>>> +>>>Hi Alon, +>>> +>>>I'm curious, what kind of system are you testing this on? I'm trying to +>>>load 100GB of data in our dbt3 workload on a 4-way itanium2. I'm +>>>interested in the results you would expect. +>>> +>>>Mark +>>> +>>> +>>> +> +>---------------------------(end of broadcast)--------------------------- +>TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> +> +> + +From pgsql-patches-owner@postgresql.org Tue Jul 19 19:51:23 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 206CC529B6 + for ; + Tue, 19 Jul 2005 19:51:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84429-03 + for ; + Tue, 19 Jul 2005 22:51:12 +0000 (GMT) +Received: from smtp.osdl.org (smtp.osdl.org [65.172.181.4]) + by svr1.postgresql.org (Postfix) with ESMTP id D59D4529FD + for ; + Tue, 19 Jul 2005 19:51:11 -0300 (ADT) +Received: from ibm-b.pdx.osdl.net (fw.osdl.org [65.172.181.6]) + (authenticated bits=0) + by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j6JMpAjA016147 + (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); + Tue, 19 Jul 2005 15:51:10 -0700 +Message-Id: <200507192251.j6JMpAjA016147@smtp.osdl.org> +Date: Tue, 19 Jul 2005 15:51:33 -0700 +From: Mark Wong +To: Andrew Dunstan +Cc: Alon Goldshuv , + pgsql-patches@postgresql.org +Subject: Re: COPY FROM performance improvements +In-Reply-To: <42DD7C10.4090008@dunslane.net> +References: <200507191954.j6JJsVjA003280@smtp.osdl.org> + + <200507192137.j6JLbZjA011011@smtp.osdl.org> + <42DD7C10.4090008@dunslane.net> +Organization: OSDL +X-Mailer: Sylpheed-Claws 1.0.4a (GTK+ 1.2.10; i686-pc-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-MIMEDefang-Filter: osdl$Revision: 1.113 $ +X-Scanned-By: MIMEDefang 2.36 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/390 +X-Sequence-Number: 16730 + +Whoopsies, yeah good point about the PRIMARY KEY. I'll fix that. + +Mark + +On Tue, 19 Jul 2005 18:17:52 -0400 +Andrew Dunstan wrote: + +> Mark, +> +> You should definitely not be doing this sort of thing, I believe: +> +> CREATE TABLE orders ( +> o_orderkey INTEGER, +> o_custkey INTEGER, +> o_orderstatus CHAR(1), +> o_totalprice REAL, +> o_orderDATE DATE, +> o_orderpriority CHAR(15), +> o_clerk CHAR(15), +> o_shippriority INTEGER, +> o_comment VARCHAR(79), +> PRIMARY KEY (o_orderkey)) +> +> Create the table with no constraints, load the data, then set up primary keys and whatever other constraints you want using ALTER TABLE. Last time I did a load like this (albeit 2 orders of magnitude smaller) I saw a 50% speedup from deferring constarint creation. +> +> +> cheers +> +> andrew +> +> +> +> Mark Wong wrote: +> +> >Hi Alon, +> > +> >Yeah, that helps. I just need to break up my scripts a little to just +> >load the data and not build indexes. +> > +> >Is the following information good enough to give a guess about the data +> >I'm loading, if you don't mind? ;) Here's a link to my script to create +> >tables: +> >http://developer.osdl.org/markw/mt/getfile.py?id=eaf16b7831588729780645b2bb44f7f23437e432&path=scripts/pgsql/create_tables.sh.in +> > +> >File sizes: +> >-rw-r--r-- 1 markw 50 2.3G Jul 8 15:03 customer.tbl +> >-rw-r--r-- 1 markw 50 74G Jul 8 15:03 lineitem.tbl +> >-rw-r--r-- 1 markw 50 2.1K Jul 8 15:03 nation.tbl +> >-rw-r--r-- 1 markw 50 17G Jul 8 15:03 orders.tbl +> >-rw-r--r-- 1 markw 50 2.3G Jul 8 15:03 part.tbl +> >-rw-r--r-- 1 markw 50 12G Jul 8 15:03 partsupp.tbl +> >-rw-r--r-- 1 markw 50 391 Jul 8 15:03 region.tbl +> >-rw-r--r-- 1 markw 50 136M Jul 8 15:03 supplier.tbl +> > +> >Number of rows: +> ># wc -l *.tbl +> > 15000000 customer.tbl +> > 600037902 lineitem.tbl +> > 25 nation.tbl +> > 150000000 orders.tbl +> > 20000000 part.tbl +> > 80000000 partsupp.tbl +> > 5 region.tbl +> > 1000000 supplier.tbl +> > +> >Thanks, +> >Mark +> > +> >On Tue, 19 Jul 2005 14:05:56 -0700 +> >"Alon Goldshuv" wrote: +> > +> > +> > +> >>Hi Mark, +> >> +> >>I improved the data *parsing* capabilities of COPY, and didn't touch the +> >>data conversion or data insertion parts of the code. The parsing improvement +> >>will vary largely depending on the ratio of parsing -to- converting and +> >>inserting. +> >> +> >>Therefore, the speed increase really depends on the nature of your data: +> >> +> >>100GB file with +> >>long data rows (lots of parsing) +> >>Small number of columns (small number of attr conversions per row) +> >>less rows (less tuple insertions) +> >> +> >>Will show the best performance improvements. +> >> +> >>However, same file size 100GB with +> >>Short data rows (minimal parsing) +> >>large number of columns (large number of attr conversions per row) +> >>AND/OR +> >>more rows (more tuple insertions) +> >> +> >>Will show improvements but not as significant. +> >>In general I'll estimate 40%-95% improvement in load speed for the 1st case +> >>and 10%-40% for the 2nd. But that also depends on the hardware, disk speed +> >>etc... This is for TEXT format. As for CSV, it may be faster but not as much +> >>as I specified here. BINARY will stay the same as before. +> >> +> >>HTH +> >>Alon. +> >> +> >> +> >> +> >> +> >> +> >> +> >>On 7/19/05 12:54 PM, "Mark Wong" wrote: +> >> +> >> +> >> +> >>>On Thu, 14 Jul 2005 17:22:18 -0700 +> >>>"Alon Goldshuv" wrote: +> >>> +> >>> +> >>> +> >>>>I revisited my patch and removed the code duplications that were there, and +> >>>>added support for CSV with buffered input, so CSV now runs faster too +> >>>>(although it is not as optimized as the TEXT format parsing). So now +> >>>>TEXT,CSV and BINARY are all parsed in CopyFrom(), like in the original file. +> >>>> +> >>>> +> >>>Hi Alon, +> >>> +> >>>I'm curious, what kind of system are you testing this on? I'm trying to +> >>>load 100GB of data in our dbt3 workload on a 4-way itanium2. I'm +> >>>interested in the results you would expect. +> >>> +> >>>Mark +> >>> +> >>> +> >>> +> > + +From pgsql-performance-owner@postgresql.org Tue Jul 19 20:01:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9DA1A52A0A + for ; + Tue, 19 Jul 2005 20:01:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 90974-01 + for ; + Tue, 19 Jul 2005 23:01:56 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 9FEAE52A00 + for ; + Tue, 19 Jul 2005 20:01:54 -0300 (ADT) +Received: (qmail 31935 invoked from network); 20 Jul 2005 01:02:32 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 20 Jul 2005 01:02:32 +0200 +To: "Oliver Crosby" , + "Sven Willenberger" +Cc: "Dawid Kuroczko" , + "Kevin Grittner" , jd@commandprompt.com, + pgsql-performance@postgresql.org +Subject: Re: Looking for tips +References: + <1efd553a0507191308219a098b@mail.gmail.com> + <758d5e7f0507191319636afaa3@mail.gmail.com> + <1efd553a050719132836c31b78@mail.gmail.com> + <1121805961.3674.25.camel@lanshark.dmv.com> + <1efd553a050719140462d41468@mail.gmail.com> +Message-ID: +Date: Wed, 20 Jul 2005 01:01:56 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <1efd553a050719140462d41468@mail.gmail.com> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/331 +X-Sequence-Number: 13572 + + + You could have a program pre-parse your log and put it in a format +understandable by COPY, then load it in a temporary table and write a part +of your application simply as a plpgsql function, reading from this table +and doing queries (or a plperl function)... + +> So... (bear with me here.. trying to make sense of this).. +> With triggers there's a way I can do the parsing I need to on a log +> file and react to completed events in non-sequential order (you can +> ignore that part.. it's just how we piece together different related +> events) and then have perl/DBD::Pg invoke a copy command (which, from +> what I can tell, has to operate on a file...) and the copy command can +> feed the ID I need back to perl so I can work with it... +> If that doesn't hurt my brain, then I'm at least kinda confused... +> Anyway. Heading home now. I'll think about this more tonight/tomorrow. +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + + + +From pgsql-patches-owner@postgresql.org Tue Jul 19 21:39:52 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BD8AA52997 + for ; + Tue, 19 Jul 2005 21:39:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16869-05 + for ; + Wed, 20 Jul 2005 00:39:38 +0000 (GMT) +Received: from mail.Mi8.com (mail.mi8.com [63.240.6.41]) + by svr1.postgresql.org (Postfix) with ESMTP id E9FF4529A1 + for ; + Tue, 19 Jul 2005 21:39:36 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- GW01 Welcome + to Mi8 Corporation www.Mi8.com); Tue, 19 Jul 2005 20:39:33 -0400 +X-Server-Uuid: F1A2E19A-84E4-48DD-8F48-B475613F58B2 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 19 Jul + 2005 20:39:33 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 19 Jul + 2005 20:39:33 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Tue, 19 Jul 2005 17:39:33 -0700 +Subject: Re: COPY FROM performance improvements +From: "Luke Lonergan" +To: "Mark Wong" , + "Andrew Dunstan" +Cc: "Alon Goldshuv" , + pgsql-patches@postgresql.org +Message-ID: +In-Reply-To: <200507192251.j6JMpAjA016147@smtp.osdl.org> +MIME-Version: 1.0 +X-OriginalArrivalTime: 20 Jul 2005 00:39:33.0522 (UTC) + FILETIME=[7F7B3720:01C58CC3] +X-WSS-ID: 6EC342CF1J47631110-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, hits=1.574 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/395 +X-Sequence-Number: 16735 + +Good points on all, another element in the performance expectations is the +ratio of CPU speed to I/O subsystem speed, as Alon had hinted earlier. + +This patch substantially (500%) improves the efficiency of parsing in the +COPY path, which, on a 3GHz P4 desktop with a commodity disk drive +represents 8 of a total of 30 seconds of processing time. So, by reducing +the parsing time from 8 seconds to 1.5 seconds, the overall COPY time is +reduced from 30 seconds to 23.5 seconds, or a speedup of about 20%. + +On a dual 2.2GHz Opteron machine with a 6-disk SCSI RAID subsystem capable +of 240MB/s sequential read and writes, the ratios change and we see between +35% and 95% increase in COPY performance, with the bottleneck being CPU. +The disk is only running at about 90MB/s during this period. + +I'd expect that as your CPUs slow down relative to your I/O speed, and +Itaniums or IT2s are quite slow, you should see an increased effect of the +parsing improvements. + +One good way to validate the effect is to watch the I/O bandwidth using +vmstat 1 (on Linux) while the load is progressing. When you watch that with +the unpatched source and with the patched source, if they are the same, you +should see no benefit from the patch (you are I/O limited). + +If you check your underlying sequential write speed, you will be +bottlenecked at roughly half that in performing COPY because of the +write-through the WAL. + +- Luke + +On 7/19/05 3:51 PM, "Mark Wong" wrote: + +> Whoopsies, yeah good point about the PRIMARY KEY. I'll fix that. +> +> Mark +> +> On Tue, 19 Jul 2005 18:17:52 -0400 +> Andrew Dunstan wrote: +> +>> Mark, +>> +>> You should definitely not be doing this sort of thing, I believe: +>> +>> CREATE TABLE orders ( +>> o_orderkey INTEGER, +>> o_custkey INTEGER, +>> o_orderstatus CHAR(1), +>> o_totalprice REAL, +>> o_orderDATE DATE, +>> o_orderpriority CHAR(15), +>> o_clerk CHAR(15), +>> o_shippriority INTEGER, +>> o_comment VARCHAR(79), +>> PRIMARY KEY (o_orderkey)) +>> +>> Create the table with no constraints, load the data, then set up primary keys +>> and whatever other constraints you want using ALTER TABLE. Last time I did a +>> load like this (albeit 2 orders of magnitude smaller) I saw a 50% speedup +>> from deferring constarint creation. +>> +>> +>> cheers +>> +>> andrew +>> +>> +>> +>> Mark Wong wrote: +>> +>>> Hi Alon, +>>> +>>> Yeah, that helps. I just need to break up my scripts a little to just +>>> load the data and not build indexes. +>>> +>>> Is the following information good enough to give a guess about the data +>>> I'm loading, if you don't mind? ;) Here's a link to my script to create +>>> tables: +>>> http://developer.osdl.org/markw/mt/getfile.py?id=eaf16b7831588729780645b2bb4 +>>> 4f7f23437e432&path=scripts/pgsql/create_tables.sh.in +>>> +>>> File sizes: +>>> -rw-r--r-- 1 markw 50 2.3G Jul 8 15:03 customer.tbl +>>> -rw-r--r-- 1 markw 50 74G Jul 8 15:03 lineitem.tbl +>>> -rw-r--r-- 1 markw 50 2.1K Jul 8 15:03 nation.tbl +>>> -rw-r--r-- 1 markw 50 17G Jul 8 15:03 orders.tbl +>>> -rw-r--r-- 1 markw 50 2.3G Jul 8 15:03 part.tbl +>>> -rw-r--r-- 1 markw 50 12G Jul 8 15:03 partsupp.tbl +>>> -rw-r--r-- 1 markw 50 391 Jul 8 15:03 region.tbl +>>> -rw-r--r-- 1 markw 50 136M Jul 8 15:03 supplier.tbl +>>> +>>> Number of rows: +>>> # wc -l *.tbl +>>> 15000000 customer.tbl +>>> 600037902 lineitem.tbl +>>> 25 nation.tbl +>>> 150000000 orders.tbl +>>> 20000000 part.tbl +>>> 80000000 partsupp.tbl +>>> 5 region.tbl +>>> 1000000 supplier.tbl +>>> +>>> Thanks, +>>> Mark +>>> +>>> On Tue, 19 Jul 2005 14:05:56 -0700 +>>> "Alon Goldshuv" wrote: +>>> +>>> +>>> +>>>> Hi Mark, +>>>> +>>>> I improved the data *parsing* capabilities of COPY, and didn't touch the +>>>> data conversion or data insertion parts of the code. The parsing +>>>> improvement +>>>> will vary largely depending on the ratio of parsing -to- converting and +>>>> inserting. +>>>> +>>>> Therefore, the speed increase really depends on the nature of your data: +>>>> +>>>> 100GB file with +>>>> long data rows (lots of parsing) +>>>> Small number of columns (small number of attr conversions per row) +>>>> less rows (less tuple insertions) +>>>> +>>>> Will show the best performance improvements. +>>>> +>>>> However, same file size 100GB with +>>>> Short data rows (minimal parsing) +>>>> large number of columns (large number of attr conversions per row) +>>>> AND/OR +>>>> more rows (more tuple insertions) +>>>> +>>>> Will show improvements but not as significant. +>>>> In general I'll estimate 40%-95% improvement in load speed for the 1st case +>>>> and 10%-40% for the 2nd. But that also depends on the hardware, disk speed +>>>> etc... This is for TEXT format. As for CSV, it may be faster but not as +>>>> much +>>>> as I specified here. BINARY will stay the same as before. +>>>> +>>>> HTH +>>>> Alon. +>>>> +>>>> +>>>> +>>>> +>>>> +>>>> +>>>> On 7/19/05 12:54 PM, "Mark Wong" wrote: +>>>> +>>>> +>>>> +>>>>> On Thu, 14 Jul 2005 17:22:18 -0700 +>>>>> "Alon Goldshuv" wrote: +>>>>> +>>>>> +>>>>> +>>>>>> I revisited my patch and removed the code duplications that were there, +>>>>>> and +>>>>>> added support for CSV with buffered input, so CSV now runs faster too +>>>>>> (although it is not as optimized as the TEXT format parsing). So now +>>>>>> TEXT,CSV and BINARY are all parsed in CopyFrom(), like in the original +>>>>>> file. +>>>>>> +>>>>>> +>>>>> Hi Alon, +>>>>> +>>>>> I'm curious, what kind of system are you testing this on? I'm trying to +>>>>> load 100GB of data in our dbt3 workload on a 4-way itanium2. I'm +>>>>> interested in the results you would expect. +>>>>> +>>>>> Mark +>>>>> +>>>>> +>>>>> +>>> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend +> + + + +From pgsql-performance-owner@postgresql.org Tue Jul 19 22:51:06 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BDFBB52982 + for ; + Tue, 19 Jul 2005 22:51:04 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25475-09 + for ; + Wed, 20 Jul 2005 01:50:55 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 9342F529E2 + for ; + Tue, 19 Jul 2005 22:50:54 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i2so1354809wra + for ; + Tue, 19 Jul 2005 18:50:59 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=PKey9uduzS/3wiTTlxYYsSSe3sBUA6Xw5Gxi0QlM3oT766Slt67D/ol3q5TBpvm7R/9RZ1eWwTFEw4e0XT/OboGaBQ+y6Xiop+eyDZccXjRnLPh6RNRIhz3ze8/tpdp4lZGLL6hj4bttFpmZ9gKwrXwrH07WxfzngdELdzy3ogM= +Received: by 10.54.125.16 with SMTP id x16mr966649wrc; + Tue, 19 Jul 2005 18:50:18 -0700 (PDT) +Received: by 10.54.150.2 with HTTP; Tue, 19 Jul 2005 18:50:18 -0700 (PDT) +Message-ID: <1efd553a050719185059de2581@mail.gmail.com> +Date: Tue, 19 Jul 2005 21:50:18 -0400 +From: Oliver Crosby +Reply-To: Oliver Crosby +To: PFC +Subject: Re: Looking for tips +Cc: Sven Willenberger , Dawid Kuroczko , + Kevin Grittner , jd@commandprompt.com, + 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: + <1efd553a0507191308219a098b@mail.gmail.com> + <758d5e7f0507191319636afaa3@mail.gmail.com> + <1efd553a050719132836c31b78@mail.gmail.com> + <1121805961.3674.25.camel@lanshark.dmv.com> + <1efd553a050719140462d41468@mail.gmail.com> + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/332 +X-Sequence-Number: 13573 + +Sorry for the lack of specifics... + +We have a file generated as a list of events, one per line. Suppose +lines 1,2,3,5,7,11,etc were related, then the last one would specify +that it's the last event. Gradually this gets assembled by a perl +script and when the last event is encountered, it gets inserted into +the db. For a given table, let's say it's of the form (a,b,c) where +'a' is a pkey, 'b' is indexed, and 'c' is other related information. +The most common 'b' values are cached locally with the perl script to +save us having to query the db. So what we end up having is: + +if 'b' exists in cache, use cached 'a' value and continue +else if 'b' exists in the db, use the associated 'a' value and continue +else add a new line with 'b', return the new 'a' and continue + +The local cache was a huge time saver with mysql. I've tried making a +plpgsql function that handles everything in one step on the db side, +but it didn't show any improvement. Time permitting, I'll try some new +approaches with changing the scripts and queries, though right now I +was just hoping to tune postgresql.conf to work better with the +hardware available. + +Thanks to everyone for your help. Very much appreciated. + +From pgsql-performance-owner@postgresql.org Wed Jul 20 01:49:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4682E528BB + for ; + Wed, 20 Jul 2005 01:49:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65946-09 + for ; + Wed, 20 Jul 2005 04:49:13 +0000 (GMT) +Received: from rambo.iniquinet.com (rambo.iniquinet.com [69.39.89.10]) + by svr1.postgresql.org (Postfix) with ESMTP id EA781528AD + for ; + Wed, 20 Jul 2005 01:49:12 -0300 (ADT) +Received: (qmail 17371 invoked by uid 1010); 20 Jul 2005 00:49:11 -0400 +Received: from Robert_Creager@LogicalChaos.org by rambo.iniquinet.com by uid + 1002 with qmail-scanner-1.20 (clamscan: 0.70. spamassassin: 3.0.3. + Clear:RC:0(63.147.78.131):SA:0(?/?):. + Processed in 1.20231 secs); 20 Jul 2005 04:49:11 -0000 +Received: from unknown (HELO thunder.logicalchaos.org) + (perl?test@logicalchaos.org@63.147.78.131) + by rambo.iniquinet.com with AES256-SHA encrypted SMTP; + 20 Jul 2005 00:49:10 -0400 +Received: from logicalchaos.org (thunder.logicalchaos.org [192.168.0.250]) + by thunder.logicalchaos.org (Postfix) with ESMTP id C141912D00B; + Tue, 19 Jul 2005 22:49:08 -0600 (MDT) +Date: Tue, 19 Jul 2005 22:49:08 -0600 +From: Robert Creager +To: Robert Creager +Cc: Tom Lane , + Robert Creager , + pgsql-performance@postgresql.org, + Andy Hewitt III +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +Message-ID: <20050719224908.15415222@thunder.logicalchaos.org> +In-Reply-To: <20050719120951.00002520@C118181.stortek.com> +References: <20050718114952.00004ac5@C118181.stortek.com> + <15472.1121709173@sss.pgh.pa.us> + <20050719105014.00007635@C118181.stortek.com> + <7322.1121792062@sss.pgh.pa.us> + <20050719120951.00002520@C118181.stortek.com> +Organization: Starlight Vision, LLC. +X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i586-mandrake-linux-gnu) +Mime-Version: 1.0 +Content-Type: multipart/signed; + boundary=Signature_Tue__19_Jul_2005_22_49_08_-0600_wWEYYWYeiUbpipZS; + protocol="application/pgp-signature"; micalg=pgp-sha1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/333 +X-Sequence-Number: 13574 + +--Signature_Tue__19_Jul_2005_22_49_08_-0600_wWEYYWYeiUbpipZS +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: quoted-printable + +When grilled further on (Tue, 19 Jul 2005 12:09:51 -0600), +Robert Creager confessed: + +> On Tue, 19 Jul 2005 12:54:22 -0400 +> Tom Lane wrote: +>=20 +> > Hmm, I hadn't thought about the possible impact of multiple concurrent +> > vacuums. Is the problem caused by that, or has performance already gone +> > into the tank by the time the cron-driven vacuums are taking long enough +> > to overlap? +>=20 +>=20 +> I'll re-start the database, vacuum full analyze and restart the runs with= +out +the +> cron vacuum running. +>=20 + +It took a few hours, but the problem did finally occur with no vacuum runni= +ng on +803. CS is averaging 72k. I cannot quantitatively say it took longer to +reproduce than with the vacuums running, but it seemed like it did. + +Can any information be gotten out of this? Should I try CVS HEAD? + +Thoughts? + +Thanks, +Rob + +--=20 + 22:41:36 up 6 days, 2:16, 6 users, load average: 0.15, 0.21, 0.30 +Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + +--Signature_Tue__19_Jul_2005_22_49_08_-0600_wWEYYWYeiUbpipZS +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iEYEARECAAYFAkLd18QACgkQLQ/DKuwDYznK2QCghoAdxDC1d7NdiXZbWbT+H0B8 +qzEAoJekKizUGtpYUdlDVo62F6N7KkKs +=M0q0 +-----END PGP SIGNATURE----- + +--Signature_Tue__19_Jul_2005_22_49_08_-0600_wWEYYWYeiUbpipZS-- + +From pgsql-performance-owner@postgresql.org Sat Jul 23 21:36:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C9EC1529A0 + for ; + Wed, 20 Jul 2005 06:11:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21737-04 + for ; + Wed, 20 Jul 2005 09:11:42 +0000 (GMT) +Received: from mailgate.intershop.de (mailgate.intershop.de [217.17.202.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 12CFB528B9 + for ; + Wed, 20 Jul 2005 06:11:41 -0300 (ADT) +Received: from JENMAIL01.ad.intershop.net ([10.0.87.43]) + by mailgate.intershop.de (8.11.6p2-2003-09-18-01/8.11.6) with ESMTP id + j6K9BYR17281 for ; + Wed, 20 Jul 2005 11:11:34 +0200 (MET DST) +X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C58D0A.CB71708E" +Subject: Re: Looking for tips +Date: Wed, 20 Jul 2005 11:05:17 +0200 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Looking for tips +Thread-Index: AcWMz8G6pIPxuVVnSO6CWDN/Q6TuAwAOmQ6e +From: "Marc Mamin" +To: "Oliver Crosby" +Cc: +X-Virus-Scanned: by AMaViS-perl11-milter (http://amavis.org/) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=HTML_30_40, + HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200507/362 +X-Sequence-Number: 13603 + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C58D0A.CB71708E +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +=20 +Hi, +I have a similar application, +but instead of adding new items to the db once at time, +I retrieve new IDs from a sequence (actually only every 10'000 times) = +and write a csv file from perl. +When finished, I load all new record in one run with Copy. +=20 +hth, +=20 +Marc Mamin + +________________________________ + +From: pgsql-performance-owner@postgresql.org on behalf of Oliver Crosby +Sent: Wed 7/20/2005 3:50 AM +To: PFC +Cc: Sven Willenberger; Dawid Kuroczko; Kevin Grittner; = +jd@commandprompt.com; pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Looking for tips + + + +Sorry for the lack of specifics... + +We have a file generated as a list of events, one per line. Suppose +lines 1,2,3,5,7,11,etc were related, then the last one would specify +that it's the last event. Gradually this gets assembled by a perl +script and when the last event is encountered, it gets inserted into +the db. For a given table, let's say it's of the form (a,b,c) where +'a' is a pkey, 'b' is indexed, and 'c' is other related information. +The most common 'b' values are cached locally with the perl script to +save us having to query the db. So what we end up having is: + +if 'b' exists in cache, use cached 'a' value and continue +else if 'b' exists in the db, use the associated 'a' value and continue +else add a new line with 'b', return the new 'a' and continue + +The local cache was a huge time saver with mysql. I've tried making a +plpgsql function that handles everything in one step on the db side, +but it didn't show any improvement. Time permitting, I'll try some new +approaches with changing the scripts and queries, though right now I +was just hoping to tune postgresql.conf to work better with the +hardware available. + +Thanks to everyone for your help. Very much appreciated. + +---------------------------(end of broadcast)--------------------------- +TIP 5: don't forget to increase your free space map settings + + + + +------_=_NextPart_001_01C58D0A.CB71708E +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +=0A= +=0A= +=0A= +=0A= +=0A= +=0A= +Re: [PERFORM] Looking for tips=0A= +=0A= +=0A= +
=0A= +
 
=0A= +
Hi,
=0A= +
I have a similar application,
=0A= +
but instead of adding new items to the db once at = +time,
=0A= +
I retrieve new IDs from a sequence (actually only = +every 10'000 =0A= +times) and write a csv file from perl.
=0A= +
When finished, I load all new record in one run with = +Copy.
=0A= +
 
=0A= +
hth,
=0A= +
 
=0A= +
Marc Mamin
=0A= +
=0A= +
=0A= +
=0A= +
From: =0A= +pgsql-performance-owner@postgresql.org on behalf of Oliver =0A= +Crosby
Sent: Wed 7/20/2005 3:50 AM
To: = +PFC
Cc: =0A= +Sven Willenberger; Dawid Kuroczko; Kevin Grittner; jd@commandprompt.com; =0A= +pgsql-performance@postgresql.org
Subject: Re: [PERFORM] = +Looking for =0A= +tips

=0A= +
=0A= +

Sorry for the lack of specifics...

We have a = +file =0A= +generated as a list of events, one per line. Suppose
lines = +1,2,3,5,7,11,etc =0A= +were related, then the last one would specify
that it's the last = +event. =0A= +Gradually this gets assembled by a perl
script and when the last = +event is =0A= +encountered, it gets inserted into
the db. For a given table, let's = +say it's =0A= +of the form (a,b,c) where
'a' is a pkey, 'b' is indexed, and 'c' is = +other =0A= +related information.
The most common 'b' values are cached locally = +with the =0A= +perl script to
save us having to query the db. So what we end up = +having =0A= +is:

if 'b' exists in cache, use cached 'a' value and = +continue
else if =0A= +'b' exists in the db, use the associated 'a' value and continue
else = +add a =0A= +new line with 'b', return the new 'a' and continue

The local = +cache was a =0A= +huge time saver with mysql. I've tried making a
plpgsql function that = +handles =0A= +everything in one step on the db side,
but it didn't show any = +improvement. =0A= +Time permitting, I'll try some new
approaches with changing the = +scripts and =0A= +queries, though right now I
was just hoping to tune postgresql.conf = +to work =0A= +better with the
hardware available.

Thanks to everyone for = +your help. =0A= +Very much appreciated.

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

=0A= +=0A= +=0A= + +------_=_NextPart_001_01C58D0A.CB71708E-- + +From pgsql-performance-owner@postgresql.org Wed Jul 20 12:25:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 04A1552A11 + for ; + Wed, 20 Jul 2005 12:25:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99736-01 + for ; + Wed, 20 Jul 2005 15:25:13 +0000 (GMT) +Received: from mail2.aeccom.com (port-212-202-101-158.static.qsc.de + [212.202.101.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 642D052A0C + for ; + Wed, 20 Jul 2005 12:25:11 -0300 (ADT) +Received: from [192.168.2.12] (port-83-236-156-26.static.qsc.de + [83.236.156.26]) by mail2.aeccom.com (Postfix) with ESMTP id ED8ED69 + for ; + Wed, 20 Jul 2005 17:25:09 +0200 (CEST) +Message-ID: <42DE6CD5.8070100@aeccom.com> +Date: Wed, 20 Jul 2005 17:25:09 +0200 +From: =?ISO-8859-1?Q?Dirk_Lutzeb=E4ck?= +Organization: AEC/communications GmbH +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: Optimizer seems to be way off, why? +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.065 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/334 +X-Sequence-Number: 13575 + +Hi, + +I do not under stand the following explain output (pgsql 8.0.3): + +explain analyze +select b.e from b, d +where b.r=516081780 and b.c=513652057 and b.e=d.e; + + QUERY PLAN +---------------------------------------------------------------------------------------------------------------- + Nested Loop (cost=0.00..1220.09 rows=1 width=4) (actual +time=0.213..2926.845 rows=324503 loops=1) + -> Index Scan using b_index on b (cost=0.00..1199.12 rows=1 +width=4) (actual time=0.104..17.418 rows=3293 loops=1) + Index Cond: (r = 516081780::oid) + Filter: (c = 513652057::oid) + -> Index Scan using d_e_index on d (cost=0.00..19.22 rows=140 +width=4) (actual time=0.009..0.380 rows=99 loops=3293) + Index Cond: ("outer".e = d.e) + Total runtime: 3638.783 ms +(7 rows) + +Why is the rows estimate for b_index and the nested loop 1? It is +actually 3293 and 324503. + +I did VACUUM ANALYZE before and I also increased the STATISTICS TARGET +on b.e to 500. No change. + +Here is the size of the tables: + +select count(oid) from b; + 3532161 + +select count(oid) from b where r=516081780 and c=513652057; + 3293 + +select count(oid) from d; + 117270 + + +Regards, + +Dirk + +From pgsql-performance-owner@postgresql.org Wed Jul 20 12:53:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B63852A1E + for ; + Wed, 20 Jul 2005 12:53:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04654-05 + for ; + Wed, 20 Jul 2005 15:53:33 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 3C841529F1 + for ; + Wed, 20 Jul 2005 12:53:32 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i21so1465165wra + for ; + Wed, 20 Jul 2005 08:53:32 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=K5jEmBr3RI051uvTjdt2tBoxgsiBxxpqw8Q79l/Bbx3IUDg7Jj8E14ab4fk4m9+LdooLzgChlBryzu1x407C/OypdE6xPIpgck5nQ0EdTTFViStzlFuG8rz+m9jWPt+Qsgl7r7hKS1gw9adWX85ZwZZRlHBcyetBp8ROq6zhTyU= +Received: by 10.54.13.37 with SMTP id 37mr139716wrm; + Wed, 20 Jul 2005 08:52:52 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Wed, 20 Jul 2005 08:52:52 -0700 (PDT) +Message-ID: <59d991c405072008523c6914bc@mail.gmail.com> +Date: Wed, 20 Jul 2005 11:52:52 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Impact of checkpoint_segments under continual load conditions +Cc: PFC , Vivek Khera , + pgsql-performance@postgresql.org +In-Reply-To: <59d991c4050719122213ac3d81@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <59d991c4050717100874c08a86@mail.gmail.com> + <59d991c40507190930244ba9bb@mail.gmail.com> + <7224.1121791328@sss.pgh.pa.us> + <59d991c4050719095440cd3de5@mail.gmail.com> + <7436.1121792725@sss.pgh.pa.us> + <59d991c405071910133e28031a@mail.gmail.com> + <7843.1121796596@sss.pgh.pa.us> + <59d991c40507191148e6f9ec5@mail.gmail.com> + <8375.1121799193@sss.pgh.pa.us> + <59d991c4050719122213ac3d81@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.143 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/335 +X-Sequence-Number: 13576 + +On 7/19/05, Christopher Petrilli wrote: +> On 7/19/05, Tom Lane wrote: +> > Christopher Petrilli writes: +> > > On 7/19/05, Tom Lane wrote: +> > >> How *exactly* are you invoking psql? +> > +> > > It is a subprocess of a Python process, driven using a pexpect +> > > interchange. I send the COPY command, then wait for the '=3D#' to com= +e +> > > back. +> > +> > Some weird interaction with pexpect maybe? Try adding "-n" (disable +> > readline) to the psql command switches. +>=20 +> Um... WOW! +> It doesn't stay QUITE that low, but it stays lower... quite a bit. +> We'll see what happens over time. + +here's a look at the difference: + +http://blog.amber.org/diagrams/pgsql_readline_impact.png + +I'm running additional comparisons AFTER clustering and analyzing the table= +s...=20 + +Chris +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Wed Jul 20 13:17:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D365F529B3 + for ; + Wed, 20 Jul 2005 13:17:17 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11254-02 + for ; + Wed, 20 Jul 2005 16:17:08 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) + by svr1.postgresql.org (Postfix) with ESMTP id 7AB055281E + for ; + Wed, 20 Jul 2005 13:17:07 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i21so1472455wra + for ; + Wed, 20 Jul 2005 09:17:07 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=i3FpIplwzZagXyHrL/fYoRMmLi+Q0fMzSVdxMpn8bcrZgWQdZbrQsQSYOLQcF8a90F1V8iZgnSPOXQTgdb1e17VvmtgAUcZ76zIdxuHiMczuP99sRlJ+R6C28F76yjQ1OPldlobZub9FoHauADaHI7jZvwnSIw2wfCrteOIAsIU= +Received: by 10.54.68.4 with SMTP id q4mr137747wra; + Wed, 20 Jul 2005 09:16:26 -0700 (PDT) +Received: by 10.54.120.11 with HTTP; Wed, 20 Jul 2005 09:16:26 -0700 (PDT) +Message-ID: <59d991c405072009163b149809@mail.gmail.com> +Date: Wed, 20 Jul 2005 12:16:26 -0400 +From: Christopher Petrilli +Reply-To: Christopher Petrilli +To: Tom Lane +Subject: Re: Impact of checkpoint_segments under continual load conditions +Cc: Vivek Khera , pgsql-performance@postgresql.org +In-Reply-To: <59d991c405071907482bb0689b@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <59d991c4050717100874c08a86@mail.gmail.com> + + <59d991c405071811457ccdd3f1@mail.gmail.com> + <16394.1121715156@sss.pgh.pa.us> + <59d991c405071812342e290f57@mail.gmail.com> + <16794.1121718743@sss.pgh.pa.us> + <59d991c405071907482bb0689b@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.141 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/336 +X-Sequence-Number: 13577 + +On 7/19/05, Christopher Petrilli wrote: +> It looks like the CVS HEAD is definately "better," but not by a huge +> amount. The only difference is I wasn't run autovacuum in the +> background (default settings), but I don't think this explains it. +> Here's a graph of the differences and density of behavior: +>=20 +> http://blog.amber.org/diagrams/pgsql_copy_803_cvs.png +>=20 +> I can provide the raw data. Each COPY was 500 rows. Note that fsync +> is turned off here. Maybe it'd be more stable with it turned on? + +I've updated this with trend-lines. + +Chris + +--=20 +| Christopher Petrilli +| petrilli@gmail.com + +From pgsql-performance-owner@postgresql.org Wed Jul 20 14:20:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B69CC52833 + for ; + Wed, 20 Jul 2005 14:20:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19724-10 + for ; + Wed, 20 Jul 2005 17:20:14 +0000 (GMT) +Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) + by svr1.postgresql.org (Postfix) with ESMTP id E925A52825 + for ; + Wed, 20 Jul 2005 14:20:12 -0300 (ADT) +Received: from mainbox.archonet.com + (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) + by smtp.metronet.co.uk (MetroNet Mail) with ESMTP + id AF17340DC9F; Wed, 20 Jul 2005 18:19:56 +0100 (BST) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP id E7EAB15EE6; + Wed, 20 Jul 2005 18:01:46 +0100 (BST) +Received: from mainbox.archonet.com ([127.0.0.1]) + by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 26694-09; Wed, 20 Jul 2005 18:01:42 +0100 (BST) +Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP id 91A6C15EE1; + Wed, 20 Jul 2005 18:01:42 +0100 (BST) +Message-ID: <42DE8375.8020205@archonet.com> +Date: Wed, 20 Jul 2005 18:01:41 +0100 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: =?ISO-8859-1?Q?Dirk_Lutzeb=E4ck?= +Cc: pgsql-performance@postgresql.org +Subject: Re: Optimizer seems to be way off, why? +References: <42DE6CD5.8070100@aeccom.com> +In-Reply-To: <42DE6CD5.8070100@aeccom.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/337 +X-Sequence-Number: 13578 + +Dirk Lutzeb=E4ck wrote: +> Hi, +>=20 +> I do not under stand the following explain output (pgsql 8.0.3): +>=20 +> explain analyze +> select b.e from b, d +> where b.r=3D516081780 and b.c=3D513652057 and b.e=3Dd.e; +>=20 +> QUERY PLAN +> -----------------------------------------------------------------------= +-----------------------------------------=20 +>=20 +> Nested Loop (cost=3D0.00..1220.09 rows=3D1 width=3D4) (actual=20 +> time=3D0.213..2926.845 rows=3D324503 loops=3D1) +> -> Index Scan using b_index on b (cost=3D0.00..1199.12 rows=3D1 wid= +th=3D4)=20 +> (actual time=3D0.104..17.418 rows=3D3293 loops=3D1) +> Index Cond: (r =3D 516081780::oid) +> Filter: (c =3D 513652057::oid) +> -> Index Scan using d_e_index on d (cost=3D0.00..19.22 rows=3D140=20 +> width=3D4) (actual time=3D0.009..0.380 rows=3D99 loops=3D3293) +> Index Cond: ("outer".e =3D d.e) +> Total runtime: 3638.783 ms +> (7 rows) +>=20 +> Why is the rows estimate for b_index and the nested loop 1? It is=20 +> actually 3293 and 324503. + +I'm guessing (and that's all it is) that b.r and b.c have a higher=20 +correlation than the planner is expecting. That is, it expects the=20 +b.c=3D... to reduce the number of matching rows much more than it is. + +Try a query just on WHERE b.r=3D516081780 and see if it gets the estimate= +=20 +right for that. + +If it's a common query, it might be worth an index on (r,c) + +-- + Richard Huxton + Archonet Ltd + + +From pgsql-performance-owner@postgresql.org Wed Jul 20 16:16:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9CDBA52A0E + for ; + Wed, 20 Jul 2005 16:16:55 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44506-03 + for ; + Wed, 20 Jul 2005 19:16:54 +0000 (GMT) +Received: from mail2.aeccom.com (port-212-202-101-158.static.qsc.de + [212.202.101.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 12D4B52A04 + for ; + Wed, 20 Jul 2005 16:16:52 -0300 (ADT) +Received: from [192.168.2.132] (openvpn02.core.aeccom.com [192.168.2.132]) + by mail2.aeccom.com (Postfix) with ESMTP + id 9549369; Wed, 20 Jul 2005 21:16:52 +0200 (CEST) +Message-ID: <42DEA308.6030608@aeccom.com> +Date: Wed, 20 Jul 2005 21:16:24 +0200 +From: =?ISO-8859-1?Q?Dirk_Lutzeb=E4ck?= +Reply-To: lutzeb@aeccom.com +User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Richard Huxton +Cc: pgsql-performance@postgresql.org +Subject: Re: Optimizer seems to be way off, why? +References: <42DE6CD5.8070100@aeccom.com> <42DE8375.8020205@archonet.com> +In-Reply-To: <42DE8375.8020205@archonet.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/338 +X-Sequence-Number: 13579 + +Richard Huxton wrote: +> Dirk Lutzeb�ck wrote: +> +>> Hi, +>> +>> I do not under stand the following explain output (pgsql 8.0.3): +>> +>> explain analyze +>> select b.e from b, d +>> where b.r=516081780 and b.c=513652057 and b.e=d.e; +>> +>> QUERY PLAN +>> ---------------------------------------------------------------------------------------------------------------- +>> +>> Nested Loop (cost=0.00..1220.09 rows=1 width=4) (actual +>> time=0.213..2926.845 rows=324503 loops=1) +>> -> Index Scan using b_index on b (cost=0.00..1199.12 rows=1 +>> width=4) (actual time=0.104..17.418 rows=3293 loops=1) +>> Index Cond: (r = 516081780::oid) +>> Filter: (c = 513652057::oid) +>> -> Index Scan using d_e_index on d (cost=0.00..19.22 rows=140 +>> width=4) (actual time=0.009..0.380 rows=99 loops=3293) +>> Index Cond: ("outer".e = d.e) +>> Total runtime: 3638.783 ms +>> (7 rows) +>> +>> Why is the rows estimate for b_index and the nested loop 1? It is +>> actually 3293 and 324503. +> +> +> I'm guessing (and that's all it is) that b.r and b.c have a higher +> correlation than the planner is expecting. That is, it expects the +> b.c=... to reduce the number of matching rows much more than it is. +> +> Try a query just on WHERE b.r=516081780 and see if it gets the estimate +> right for that. +> +> If it's a common query, it might be worth an index on (r,c) +> +> -- +> Richard Huxton +> Archonet Ltd +> + +Thanks Richard, dropping the join for b.c now gives better estimates (it +also uses a different index now) although not accurate (off by factor +10). This query is embedded in a larger query which now got a 1000 times +speed up (!) because I can drop b.c because it is redundant. + +Though, why can't the planner see this correlation? I think somebody +said the planner does not know about multiple column correlations, does it? + +Regards, + +Dirk + + +From pgsql-performance-owner@postgresql.org Wed Jul 20 17:28:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E5C75293B + for ; + Wed, 20 Jul 2005 17:28:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57065-04 + for ; + Wed, 20 Jul 2005 20:28:33 +0000 (GMT) +Received: from calvin.surfutopia.net (calvin.surfutopia.net [67.120.245.34]) + by svr1.postgresql.org (Postfix) with ESMTP id C9B1252AA5 + for ; + Wed, 20 Jul 2005 17:28:31 -0300 (ADT) +Received: by calvin.surfutopia.net (Postfix, from userid 1000) + id 7ADC9F23B; Wed, 20 Jul 2005 13:28:32 -0700 (PDT) +Date: Wed, 20 Jul 2005 13:28:32 -0700 +From: John Mendenhall +To: pgsql-performance list +Subject: Re: performance decrease after reboot +Message-ID: <20050720202832.GA22109@calvin.surfutopia.net> +References: <20050719210557.GA30794@calvin.surfutopia.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050719210557.GA30794@calvin.surfutopia.net> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/339 +X-Sequence-Number: 13580 + +On Tue, 19 Jul 2005, John Mendenhall wrote: + +> I tuned a query last week to obtain acceptable performance. +> Here is my recorded explain analyze results: +> +> LOG: duration: 826.505 ms statement: explain analyze +> [cut for brevity] +> +> I rebooted the database machine later that night. +> Now, when I run the same query, I get the following +> results: +> +> LOG: duration: 6931.701 ms statement: explain analyze +> [cut for brevity] + +I just ran my query again, no changes from yesterday +and it is back to normal: + +LOG: duration: 795.839 ms statement: explain analyze + +What could have been the problem? + +The major differences in the query plan are as follows: + +(1) The one that runs faster uses a Hash Join at the +very top of the query plan. It does a Hash Cond on +the country and code fields. + +(2) The one that runs slower uses a Materialize with +the subplan, with no Hash items. The Materialize does +Seq Scan of the countries table, and above it, a Join +Filter is run. + +(3) The partners_pkey index on the partners table is +in a different place in the query. + +Does anyone know what would cause the query plan to be +different like this, for the same server, same query? +I run vacuum analyze every night. Is this perhaps the +problem? + +What setting do I need to tweak to make sure the faster +plan is always found? + +Thanks for any pointers in this dilemma. + +JohnM + +-- +John Mendenhall +john@surfutopia.net +surf utopia +internet services + +From pgsql-performance-owner@postgresql.org Wed Jul 20 17:58:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B9BD52A44 + for ; + Wed, 20 Jul 2005 17:58:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61845-08 + for ; + Wed, 20 Jul 2005 20:57:59 +0000 (GMT) +Received: from ionian.i-clic.uihc.uiowa.edu (ionian.i-clic.uihc.uiowa.edu + [129.255.211.20]) + by svr1.postgresql.org (Postfix) with ESMTP id 5A00952833 + for ; + Wed, 20 Jul 2005 17:57:54 -0300 (ADT) +Received: by ionian.i-clic.uihc.uiowa.edu (Postfix, from userid 76) + id 6B61261DAF; Wed, 20 Jul 2005 14:50:13 -0500 (CDT) +Received: from [192.168.1.104] (65-100-17-227.cdrr.qwest.net [65.100.17.227]) + by ionian.i-clic.uihc.uiowa.edu (Postfix) with ESMTP + id 5EEC461DAE; Wed, 20 Jul 2005 14:50:11 -0500 (CDT) +Message-ID: <42DEBACF.2020405@arbash-meinel.com> +Date: Wed, 20 Jul 2005 15:57:51 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: lutzeb@aeccom.com +Cc: Richard Huxton , + pgsql-performance@postgresql.org +Subject: Re: Optimizer seems to be way off, why? +References: <42DE6CD5.8070100@aeccom.com> <42DE8375.8020205@archonet.com> + <42DEA308.6030608@aeccom.com> +In-Reply-To: <42DEA308.6030608@aeccom.com> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig94CE97DBB20D147FCE6A8757" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/340 +X-Sequence-Number: 13581 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig94CE97DBB20D147FCE6A8757 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable + +Dirk Lutzeb=E4ck wrote: +> Richard Huxton wrote: +>=20 +>> Dirk Lutzeb=E4ck wrote: +>> +>>> Hi, +>>> +>>> I do not under stand the following explain output (pgsql 8.0.3): +>>> +>>> explain analyze +>>> select b.e from b, d +>>> where b.r=3D516081780 and b.c=3D513652057 and b.e=3Dd.e; +>>> +>>> QUERY PLAN +>>> ---------------------------------------------------------------------= +------------------------------------------- +>>> +>>> Nested Loop (cost=3D0.00..1220.09 rows=3D1 width=3D4) (actual +>>> time=3D0.213..2926.845 rows=3D324503 loops=3D1) +>>> -> Index Scan using b_index on b (cost=3D0.00..1199.12 rows=3D1 +>>> width=3D4) (actual time=3D0.104..17.418 rows=3D3293 loops=3D1) +>>> Index Cond: (r =3D 516081780::oid) +>>> Filter: (c =3D 513652057::oid) +>>> -> Index Scan using d_e_index on d (cost=3D0.00..19.22 rows=3D140= + +>>> width=3D4) (actual time=3D0.009..0.380 rows=3D99 loops=3D3293) +>>> Index Cond: ("outer".e =3D d.e) +>>> Total runtime: 3638.783 ms +>>> (7 rows) +>>> +>>> Why is the rows estimate for b_index and the nested loop 1? It is +>>> actually 3293 and 324503. +>> +>> +>> +>> I'm guessing (and that's all it is) that b.r and b.c have a higher +>> correlation than the planner is expecting. That is, it expects the +>> b.c=3D... to reduce the number of matching rows much more than it is. +>> +>> Try a query just on WHERE b.r=3D516081780 and see if it gets the +>> estimate right for that. +>> +>> If it's a common query, it might be worth an index on (r,c) +>> +>> --=20 +>> Richard Huxton +>> Archonet Ltd +>> +>=20 +> Thanks Richard, dropping the join for b.c now gives better estimates (i= +t +> also uses a different index now) although not accurate (off by factor +> 10). This query is embedded in a larger query which now got a 1000 time= +s +> speed up (!) because I can drop b.c because it is redundant. + +Well, part of the problem is that the poorly estimated row is not 'b.e' +but 'b.r', it expects to only find one row that matches, and instead +finds 3293 rows. + +Now, that *could* be because it mis-estimates the selectivity of b.r & b.= +c. + +It actually estimated the join with d approximately correctly. (It +thought that for each row it would find 140, and it averaged 99). + +>=20 +> Though, why can't the planner see this correlation? I think somebody +> said the planner does not know about multiple column correlations, does= + it? + +The planner does not maintain cross-column statistics, so you are +correct. I believe it assumes distributions are independent. So that if +r=3DRRRRR is 10% selective, and c=3DCCCC is 20% selective, the total +selectivity of r=3DRRRR AND c=3DCCCC is 2%. I could be wrong on this, but= + I +think it is approximately correct. + +Now if you created the index on b(r,c), then it would have a much better +idea of how selective that would be. At the very least, it could index +on (r,c) rather than indexing on (r) and filtering by (c). + +Also, if you have very skewed data (where you have 1 value 100k times, +and 50 values only 10times each), the planner can overestimate the low +values, and underestimate the high one. (It uses random sampling, so it +kind of depends where the entries are.) + +Have you tried increasing the statistics on b.r and or b.c? Do you have +an index on b.c or just b.r? + +To see what the planner thinks, you might try: + +EXPLAIN ANALYZE +select count(*) from b where r=3D516081780; + +That would tell you how selective the planner thinks the r=3D is. +>=20 +> Regards, +>=20 +> Dirk +>=20 +John +=3D:-> + + +--------------enig94CE97DBB20D147FCE6A8757 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC3rrTJdeBCYSNAAMRAihcAJ4ime7NRUFh5qAs5gueJTu6mx5YagCgmYuo ++OUMPNe8fv5k22wO96NKP5U= +=7G8I +-----END PGP SIGNATURE----- + +--------------enig94CE97DBB20D147FCE6A8757-- + +From pgsql-performance-owner@postgresql.org Sat Jul 23 21:42:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B98C152B1C + for ; + Thu, 21 Jul 2005 07:02:11 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19776-03 + for ; + Thu, 21 Jul 2005 10:02:10 +0000 (GMT) +Received: from charon.4soft.de (charon.4soft.de [62.159.46.131]) + by svr1.postgresql.org (Postfix) with ESMTP id 8974B52AE8 + for ; + Thu, 21 Jul 2005 07:02:06 -0300 (ADT) +Received: from zeus.4soft.de (zeus.4soft.de [172.16.0.1]) + by charon.4soft.de (Postfix) with ESMTP id C1672D098 + for ; + Thu, 21 Jul 2005 12:02:08 +0200 (CEST) +Received: from [172.16.1.14] (eos.4soft.de [172.16.1.14]) + by zeus.4soft.de (8.12.8/8.12.8) with ESMTP id j6LA25Fh012809 + for ; Thu, 21 Jul 2005 12:02:05 +0200 +Message-ID: <42DF72AA.3090207@4soft.de> +Date: Thu, 21 Jul 2005 12:02:18 +0200 +From: Achim Luber +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Size of empty varchar and size of index +X-Enigmail-Version: 0.92.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by AMaViS-perl11-milter (http://amavis.org/) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/365 +X-Sequence-Number: 13606 + +Hello, +I'm searching for two facts: +How much space takes a varchar column if there is no value in it (NULL)? +How much space needs a index of an integer column? +Hope I post to the right list and hope anybody can help me. +Thank you +Greetings +Achim + +From pgsql-performance-owner@postgresql.org Thu Jul 21 12:58:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0E19552A81 + for ; + Thu, 21 Jul 2005 12:58:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97103-01 + for ; + Thu, 21 Jul 2005 15:58:54 +0000 (GMT) +Received: from rwcrmhc12.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) + by svr1.postgresql.org (Postfix) with ESMTP id 772BD52997 + for ; + Thu, 21 Jul 2005 12:58:51 -0300 (ADT) +Received: from [192.168.1.52] + (c-24-60-119-214.hsd1.ma.comcast.net[24.60.119.214]) + by comcast.net (rwcrmhc13) with ESMTP + id <20050721155850015001v13ce>; Thu, 21 Jul 2005 15:58:51 +0000 +Message-ID: <42DFC641.1020404@comcast.net> +Date: Thu, 21 Jul 2005 11:58:57 -0400 +From: Jeffrey Tenny +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: What is best way to stream terabytes of data into postgresql? +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.295 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST +X-Spam-Level: * +X-Archive-Number: 200507/341 +X-Sequence-Number: 13582 + +Preferably via JDBC, but by C/C++ if necessary. + +Streaming being the operative word. + +Tips appreciated. + +From pgsql-performance-owner@postgresql.org Thu Jul 21 14:45:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9E2FC52905 + for ; + Thu, 21 Jul 2005 14:45:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 35440-02 + for ; + Thu, 21 Jul 2005 17:45:23 +0000 (GMT) +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by svr1.postgresql.org (Postfix) with ESMTP id 1F89E528F9 + for ; + Thu, 21 Jul 2005 14:45:19 -0300 (ADT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr4.postgresql.org (Postfix) with ESMTP id BE25C5AFAE9 + for ; + Thu, 21 Jul 2005 16:49:15 +0000 (GMT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1Dve5p-00060p-00; Thu, 21 Jul 2005 12:40:17 -0400 +To: John A Meinel +Cc: lutzeb@aeccom.com, Richard Huxton , + pgsql-performance@postgresql.org +Subject: Re: Optimizer seems to be way off, why? +References: <42DE6CD5.8070100@aeccom.com> <42DE8375.8020205@archonet.com> + <42DEA308.6030608@aeccom.com> <42DEBACF.2020405@arbash-meinel.com> +In-Reply-To: <42DEBACF.2020405@arbash-meinel.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 21 Jul 2005 12:40:17 -0400 +Message-ID: <87vf34cdu6.fsf@stark.xeocode.com> +Lines: 16 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/342 +X-Sequence-Number: 13583 + + +John A Meinel writes: + +> Now if you created the index on b(r,c), then it would have a much better +> idea of how selective that would be. At the very least, it could index +> on (r,c) rather than indexing on (r) and filtering by (c). + +There has been some discussion of adding functionality like this but afaik no +version of Postgres actually does this yet. + +Adding the index may still help though. + + + +-- +greg + + +From pgsql-performance-owner@postgresql.org Thu Jul 21 15:28:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0720752B72 + for ; + Thu, 21 Jul 2005 15:28:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37303-01 + for ; + Thu, 21 Jul 2005 18:28:26 +0000 (GMT) +Received: from mail.Mi8.com (mail.mi8.com [63.240.6.41]) + by svr1.postgresql.org (Postfix) with ESMTP id 1288F52B3B + for ; + Thu, 21 Jul 2005 15:28:25 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- GW01 Welcome + to Mi8 Corporation www.Mi8.com); Thu, 21 Jul 2005 14:28:18 -0400 +X-Server-Uuid: F1A2E19A-84E4-48DD-8F48-B475613F58B2 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 21 Jul + 2005 14:28:18 -0400 +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: Re: What is best way to stream terabytes of data into +Date: Thu, 21 Jul 2005 14:26:04 -0400 +Message-ID: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] What is best way to stream terabytes of data + into postgresql? +Thread-Index: AcWODTo78umGiTNxTN2A4mg23ktjvQAEfrKQ +From: "Frank Wosczyna" +To: "Jeffrey Tenny" , + pgsql-performance@postgresql.org +X-OriginalArrivalTime: 21 Jul 2005 18:28:18.0694 (UTC) + FILETIME=[F779B260:01C58E21] +X-WSS-ID: 6EC136C81J49368304-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/343 +X-Sequence-Number: 13584 + +=20 + + +> Subject: [PERFORM] What is best way to stream terabytes of=20 +> data into postgresql? +>=20 +> Preferably via JDBC, but by C/C++ if necessary. +>=20 +> Streaming being the operative word. +>=20 +> Tips appreciated. +>=20 + +Hi, + +We granted our Java Loader to the Bizgres Open Source, +http://www.bizgres.org/assets/BZ_userguide.htm#50413574_pgfId-110126 + +You can load from STDIN instead of a file, as long as you prepend the +stream with the Loader Control file, for example: + +for name in customer orders lineitem partsupp supplier part;do;cat +TPCH_load_100gb_${name}.ctl /mnt//TPCH-Data/${name}.tbl.* | +loader.sh -h localhost -p 10001 -d tpch -t -u mpp; done + +You can also run the loader from a remote host as well, with the "-h" + being the target system with the Postgres database. + +If you have terabytes of data, you might want to set a batch size (-b +switch) to commit occasionally. + +Feel free to contact me directly if you have questions. + +Thanks, + +Frank + +Frank Wosczyna +Systems Engineer +Greenplum / Bizgres MPP +www.greenplum.com + + +From pgsql-patches-owner@postgresql.org Thu Jul 21 18:55:10 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A2E00529D8 + for ; + Thu, 21 Jul 2005 18:55:08 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54040-08 + for ; + Thu, 21 Jul 2005 21:55:02 +0000 (GMT) +Received: from smtp.osdl.org (smtp.osdl.org [65.172.181.4]) + by svr1.postgresql.org (Postfix) with ESMTP id D9A3B52999 + for ; + Thu, 21 Jul 2005 18:54:58 -0300 (ADT) +Received: from ibm-b.pdx.osdl.net (fw.osdl.org [65.172.181.6]) + (authenticated bits=0) + by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j6LLsdjA002847 + (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); + Thu, 21 Jul 2005 14:54:39 -0700 +Message-Id: <200507212154.j6LLsdjA002847@smtp.osdl.org> +Date: Thu, 21 Jul 2005 14:55:07 -0700 +From: Mark Wong +To: "Luke Lonergan" +Cc: "Andrew Dunstan" , + "Alvaro Herrera" , + "Bruce Momjian" , + "Alon Goldshuv" , + pgsql-patches@postgresql.org, maryedie@osdl.org +Subject: Re: COPY FROM performance improvements +In-Reply-To: +References: <42C05F88.7000105@dunslane.net> + +Organization: OSDL +X-Mailer: Sylpheed-Claws 1.0.4a (GTK+ 1.2.10; i686-pc-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-MIMEDefang-Filter: osdl$Revision: 1.113 $ +X-Scanned-By: MIMEDefang 2.36 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/424 +X-Sequence-Number: 16764 + +I just ran through a few tests with the v14 patch against 100GB of data +from dbt3 and found a 30% improvement; 3.6 hours vs 5.3 hours. Just to +give a few details, I only loaded data and started a COPY in parallel +for each the data files: + http://www.testing.osdl.org/projects/dbt3testing/results/fast_copy/ + +Here's a visual of my disk layout, for those familiar with the database schema: + http://www.testing.osdl.org/projects/dbt3testing/results/fast_copy/layout-dev4-010-dbt3.html + +I have 6 arrays of fourteen 15k rpm drives in a split-bus configuration +attached to a 4-way itanium2 via 6 compaq smartarray pci-x controllers. + +Let me know if you have any questions. + +Mark + +From pgsql-patches-owner@postgresql.org Thu Jul 21 20:15:06 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A5CAA528DE + for ; + Thu, 21 Jul 2005 20:15:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16472-01 + for ; + Thu, 21 Jul 2005 23:14:57 +0000 (GMT) +Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) + by svr1.postgresql.org (Postfix) with ESMTP id D9BEA52836 + for ; + Thu, 21 Jul 2005 20:14:55 -0300 (ADT) +Received: from 172.16.1.118 by mail.Mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D1)); Thu, 21 Jul 2005 19:14:49 -0400 +X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 21 Jul + 2005 19:14:48 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Thu, 21 Jul + 2005 19:14:48 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Thu, 21 Jul 2005 16:14:47 -0700 +Subject: Re: COPY FROM performance improvements +From: "Luke Lonergan" +To: "Mark Wong" +Cc: "Andrew Dunstan" , + "Alvaro Herrera" , + "Bruce Momjian" , + "Alon Goldshuv" , + pgsql-patches@postgresql.org, maryedie@osdl.org +Message-ID: +In-Reply-To: <200507212154.j6LLsdjA002847@smtp.osdl.org> +MIME-Version: 1.0 +X-OriginalArrivalTime: 21 Jul 2005 23:14:48.0751 (UTC) + FILETIME=[FD8C3BF0:01C58E49] +X-WSS-ID: 6EFEF3E32B44412511-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, hits=1.574 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/425 +X-Sequence-Number: 16765 + +Cool! + +At what rate does your disk setup write sequential data, e.g.: + time dd if=/dev/zero of=bigfile bs=8k count=500000 + +(sized for 2x RAM on a system with 2GB) + +BTW - the Compaq smartarray controllers are pretty broken on Linux from a +performance standpoint in our experience. We've had disastrously bad +results from the SmartArray 5i and 6 controllers on kernels from 2.4 -> +2.6.10, on the order of 20MB/s. + +For comparison, the results on our dual opteron with a single LSI SCSI +controller with software RAID0 on a 2.6.10 kernel: + +[llonergan@stinger4 dbfast]$ time dd if=/dev/zero of=bigfile bs=8k +count=500000 +500000+0 records in +500000+0 records out + +real 0m24.702s +user 0m0.077s +sys 0m8.794s + +Which calculates out to about 161MB/s. + +- Luke + + +On 7/21/05 2:55 PM, "Mark Wong" wrote: + +> I just ran through a few tests with the v14 patch against 100GB of data +> from dbt3 and found a 30% improvement; 3.6 hours vs 5.3 hours. Just to +> give a few details, I only loaded data and started a COPY in parallel +> for each the data files: +> http://www.testing.osdl.org/projects/dbt3testing/results/fast_copy/ +> +> Here's a visual of my disk layout, for those familiar with the database +> schema: +> http://www.testing.osdl.org/projects/dbt3testing/results/fast_copy/layout-dev4 +> -010-dbt3.html +> +> I have 6 arrays of fourteen 15k rpm drives in a split-bus configuration +> attached to a 4-way itanium2 via 6 compaq smartarray pci-x controllers. +> +> Let me know if you have any questions. +> +> Mark +> + + + +From pgsql-patches-owner@postgresql.org Thu Jul 21 21:08:02 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 75076529ED + for ; + Thu, 21 Jul 2005 21:07:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46523-04 + for ; + Fri, 22 Jul 2005 00:07:56 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 9C14552901 + for ; + Thu, 21 Jul 2005 21:07:56 -0300 (ADT) +Received: from [192.168.1.100] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j6M07Rhr028248; Thu, 21 Jul 2005 17:07:35 -0700 +Message-ID: <42E038E9.1080107@commandprompt.com> +Date: Thu, 21 Jul 2005 17:08:09 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Luke Lonergan +Cc: Mark Wong , Andrew Dunstan , + Alvaro Herrera , + Bruce Momjian , + Alon Goldshuv , + pgsql-patches@postgresql.org, maryedie@osdl.org +Subject: Re: COPY FROM performance improvements +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/426 +X-Sequence-Number: 16766 + +Luke Lonergan wrote: +> Cool! +> +> At what rate does your disk setup write sequential data, e.g.: +> time dd if=/dev/zero of=bigfile bs=8k count=500000 +> +> (sized for 2x RAM on a system with 2GB) +> +> BTW - the Compaq smartarray controllers are pretty broken on Linux from a +> performance standpoint in our experience. We've had disastrously bad +> results from the SmartArray 5i and 6 controllers on kernels from 2.4 -> +> 2.6.10, on the order of 20MB/s. + +O.k. this strikes me as interesting, now we know that Compaq and Dell +are borked for Linux. Is there a name brand server (read Enterprise) +that actually does provide reasonable performance? + +> +> For comparison, the results on our dual opteron with a single LSI SCSI +> controller with software RAID0 on a 2.6.10 kernel: +> +> [llonergan@stinger4 dbfast]$ time dd if=/dev/zero of=bigfile bs=8k +> count=500000 +> 500000+0 records in +> 500000+0 records out +> +> real 0m24.702s +> user 0m0.077s +> sys 0m8.794s +> +> Which calculates out to about 161MB/s. +> +> - Luke +> +> +> On 7/21/05 2:55 PM, "Mark Wong" wrote: +> +> +>>I just ran through a few tests with the v14 patch against 100GB of data +>>from dbt3 and found a 30% improvement; 3.6 hours vs 5.3 hours. Just to +>>give a few details, I only loaded data and started a COPY in parallel +>>for each the data files: +>>http://www.testing.osdl.org/projects/dbt3testing/results/fast_copy/ +>> +>>Here's a visual of my disk layout, for those familiar with the database +>>schema: +>>http://www.testing.osdl.org/projects/dbt3testing/results/fast_copy/layout-dev4 +>>-010-dbt3.html +>> +>>I have 6 arrays of fourteen 15k rpm drives in a split-bus configuration +>>attached to a 4-way itanium2 via 6 compaq smartarray pci-x controllers. +>> +>>Let me know if you have any questions. +>> +>>Mark +>> +> +> +> +> +> ---------------------------(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 + + +-- +Your PostgreSQL solutions provider, Command Prompt, Inc. +24x7 support - 1.800.492.2240, programming, and consulting +Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit +http://www.commandprompt.com / http://www.postgresql.org + +From pgsql-performance-owner@postgresql.org Thu Jul 21 21:23:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CFCDB529F5 + for ; + Thu, 21 Jul 2005 21:23:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52149-08 + for ; + Fri, 22 Jul 2005 00:23:18 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 6551B52B91 + for ; + Thu, 21 Jul 2005 21:23:17 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7639743; Thu, 21 Jul 2005 17:25:34 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: What is best way to stream terabytes of data into postgresql? +Date: Thu, 21 Jul 2005 17:26:03 -0700 +User-Agent: KMail/1.8 +Cc: Jeffrey Tenny +References: <42DFC641.1020404@comcast.net> +In-Reply-To: <42DFC641.1020404@comcast.net> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200507211726.03438.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/344 +X-Sequence-Number: 13585 + +Jeff, + +> Streaming being the operative word. + +Not sure how much hacking you want to do, but the TelegraphCQ project is +based on PostgreSQL: +http://telegraph.cs.berkeley.edu/telegraphcq/v0.2/ + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-patches-owner@postgresql.org Thu Jul 21 23:05:13 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3DE4952BBD + for ; + Thu, 21 Jul 2005 23:05:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20073-03 + for ; + Fri, 22 Jul 2005 02:05:01 +0000 (GMT) +Received: from mail.Mi8.com (mail.mi8.com [63.240.6.50]) + by svr1.postgresql.org (Postfix) with ESMTP id 80AD0529E9 + for ; + Thu, 21 Jul 2005 23:04:59 -0300 (ADT) +Received: from 172.16.1.118 by mail.Mi8.com with ESMTP (- GW05 Welcome + to Mi8 Corporation www.Mi8.com); Thu, 21 Jul 2005 22:04:57 -0400 +X-Server-Uuid: E0C866E6-C6CD-48B5-AE61-E57E73CF3CC7 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 21 Jul + 2005 22:04:57 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Thu, 21 Jul + 2005 22:04:56 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Thu, 21 Jul 2005 19:04:55 -0700 +Subject: Re: COPY FROM performance improvements +From: "Luke Lonergan" +To: "Joshua D. Drake" +Cc: "Mark Wong" , "Andrew Dunstan" , + "Alvaro Herrera" , + "Bruce Momjian" , + "Alon Goldshuv" , + pgsql-patches@postgresql.org, maryedie@osdl.org +Message-ID: +In-Reply-To: <42E038E9.1080107@commandprompt.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 22 Jul 2005 02:04:57.0229 (UTC) + FILETIME=[C2465BD0:01C58E61] +X-WSS-ID: 6EFE8BC31M89611019-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, hits=1.574 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/427 +X-Sequence-Number: 16767 + +Joshua, + +On 7/21/05 5:08 PM, "Joshua D. Drake" wrote: + +> O.k. this strikes me as interesting, now we know that Compaq and Dell +> are borked for Linux. Is there a name brand server (read Enterprise) +> that actually does provide reasonable performance? + +I think late model Dell (post the bad chipset problem, circa 2001-2?) and +IBM and Sun servers are fine because they all use simple SCSI adapters from +LSI or Adaptec. + +The HP Smartarray is an aberration, they don't have good driver support for +Linux and as a consequence have some pretty bad problems with both +performance and stability. On Windows they perform quite well. + +Also - there are very big issues with some SATA controllers and Linux we've +seen, particularly the Silicon Image, Highpoint other non-Intel controllers. +Not sure about Nvidia, but the only ones I trust now are 3Ware and the +others mentioned in earlier posts. + +- Luke + + + + + +From pgsql-patches-owner@postgresql.org Thu Jul 21 23:53:33 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 06E6252A70 + for ; + Thu, 21 Jul 2005 23:53:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25246-07 + for ; + Fri, 22 Jul 2005 02:53:18 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id E6304528DE + for ; + Thu, 21 Jul 2005 23:53:17 -0300 (ADT) +Received: from [192.168.1.100] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j6M2qqhr006958; Thu, 21 Jul 2005 19:52:53 -0700 +Message-ID: <42E05FAF.70601@commandprompt.com> +Date: Thu, 21 Jul 2005 19:53:35 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Luke Lonergan +Cc: Mark Wong , Andrew Dunstan , + Alvaro Herrera , + Bruce Momjian , + Alon Goldshuv , + pgsql-patches@postgresql.org, maryedie@osdl.org +Subject: Re: COPY FROM performance improvements +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/428 +X-Sequence-Number: 16768 + + +> I think late model Dell (post the bad chipset problem, circa 2001-2?) and +> IBM and Sun servers are fine because they all use simple SCSI adapters from +> LSI or Adaptec. + +Well I know that isn't true at least not with ANY of the Dells my +customers have purchased in the last 18 months. They are still really, +really slow. + +> Also - there are very big issues with some SATA controllers and Linux we've +> seen, particularly the Silicon Image, Highpoint other non-Intel controllers. +> Not sure about Nvidia, but the only ones I trust now are 3Ware and the +> others mentioned in earlier posts. + +I have great success with Silicon Image as long as I am running them +with Linux software RAID. The LSI controllers are also really nice. + +J + + + +> +> - Luke +> +> +> + + +-- +Your PostgreSQL solutions provider, Command Prompt, Inc. +24x7 support - 1.800.492.2240, programming, and consulting +Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit +http://www.commandprompt.com / http://www.postgresql.org + +From pgsql-patches-owner@postgresql.org Fri Jul 22 01:19:22 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 22D0B52892 + for ; + Fri, 22 Jul 2005 01:19:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55075-09 + for ; + Fri, 22 Jul 2005 04:19:18 +0000 (GMT) +Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) + by svr1.postgresql.org (Postfix) with ESMTP id 0902652ABE + for ; + Fri, 22 Jul 2005 01:19:16 -0300 (ADT) +Received: from 172.16.1.118 by mail.mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D4)); Fri, 22 Jul 2005 00:19:07 -0400 +X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 22 Jul + 2005 00:19:06 -0400 +Received: from 24.5.173.15 ([24.5.173.15]) 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, 22 Jul + 2005 00:19:05 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Thu, 21 Jul 2005 21:19:04 -0700 +Subject: Re: COPY FROM performance improvements +From: "Luke Lonergan" +To: "Joshua D. Drake" +Cc: "Mark Wong" , "Andrew Dunstan" , + "Alvaro Herrera" , + "Bruce Momjian" , + "Alon Goldshuv" , + pgsql-patches@postgresql.org, maryedie@osdl.org +Message-ID: +In-Reply-To: <42E05FAF.70601@commandprompt.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 22 Jul 2005 04:19:06.0968 (UTC) + FILETIME=[804B0D80:01C58E74] +X-WSS-ID: 6EFEAC3046K1855287-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, hits=1.6 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/429 +X-Sequence-Number: 16769 + +Joshua, + +On 7/21/05 7:53 PM, "Joshua D. Drake" wrote: +> Well I know that isn't true at least not with ANY of the Dells my +> customers have purchased in the last 18 months. They are still really, +> really slow. + +That's too bad, can you cite some model numbers? SCSI? + +> I have great success with Silicon Image as long as I am running them +> with Linux software RAID. The LSI controllers are also really nice. + +That's good to hear, I gave up on Silicon Image controllers on Linux about 1 +year ago, which kernel are you using with success? Silicon Image +controllers are the most popular, so it's important to see them supported +well, though I'd rather see more SATA headers than 2 off of the built-in +chipsets. + +- Luke + + + +From pgsql-patches-owner@postgresql.org Fri Jul 22 03:13:55 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9B31D528DC + for ; + Fri, 22 Jul 2005 03:13:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87709-01 + for ; + Fri, 22 Jul 2005 06:13:46 +0000 (GMT) +Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) + by svr1.postgresql.org (Postfix) with ESMTP id D04D752BA1 + for ; + Fri, 22 Jul 2005 03:13:45 -0300 (ADT) +Received: from dunslane.net (localhost.localdomain [127.0.0.1]) + (authenticated (0 bits)) + by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id j6M5Res23270; + Fri, 22 Jul 2005 00:27:40 -0500 +Received: from 24.211.165.134 + (SquirrelMail authenticated user andrew@dunslane.net) + by www.dunslane.net with HTTP; Fri, 22 Jul 2005 00:27:41 -0500 (CDT) +Message-ID: <3277.24.211.165.134.1122010061.squirrel@www.dunslane.net> +Date: Fri, 22 Jul 2005 00:27:41 -0500 (CDT) +Subject: Re: COPY FROM performance improvements +From: "Andrew Dunstan" +To: +In-Reply-To: +References: +X-Priority: 3 +Importance: Normal +X-MSMail-Priority: Normal +Cc: , , , + , , + , , + +X-Mailer: SquirrelMail (version 1.2.5) +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/430 +X-Sequence-Number: 16770 + + +this discussion belongs on -performance + +cheers + +andrew + + +Luke Lonergan said: +> Joshua, +> +> On 7/21/05 7:53 PM, "Joshua D. Drake" wrote: +>> Well I know that isn't true at least not with ANY of the Dells my +>> customers have purchased in the last 18 months. They are still really, +>> really slow. +> +> That's too bad, can you cite some model numbers? SCSI? +> +>> I have great success with Silicon Image as long as I am running them +>> with Linux software RAID. The LSI controllers are also really nice. +> +> That's good to hear, I gave up on Silicon Image controllers on Linux +> about 1 year ago, which kernel are you using with success? Silicon +> Image +> controllers are the most popular, so it's important to see them +> supported well, though I'd rather see more SATA headers than 2 off of +> the built-in chipsets. +> +> - Luke + + + + +From pgsql-performance-owner@postgresql.org Fri Jul 22 10:06:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E28DD5284E + for ; + Fri, 22 Jul 2005 10:06:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81088-01 + for ; + Fri, 22 Jul 2005 13:06:15 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.200]) + by svr1.postgresql.org (Postfix) with ESMTP id CCAD952863 + for ; + Fri, 22 Jul 2005 10:06:14 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id i28so193593nzi + for ; + Fri, 22 Jul 2005 06:06:15 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; + b=LBh8BtXXDBt6pHS7SX2EytQveROsyFSORjVaaIq2dtCOcGrbQObA0ulaZjN1vThSE2e1MuEP1Ia0hILUCxjTh+5k095uArvfjKV8miTsEV3X3L3YkHLbKUoIWgiQYK9jCtlQ50dwidXFcRIRja5ACaC86pHujF7XxlB9GjYVbK0= +Received: by 10.36.60.18 with SMTP id i18mr1407065nza; + Fri, 22 Jul 2005 02:10:05 -0700 (PDT) +Received: by 10.36.22.20 with HTTP; Fri, 22 Jul 2005 02:10:05 -0700 (PDT) +Message-ID: <758d5e7f0507220210bfa4978@mail.gmail.com> +Date: Fri, 22 Jul 2005 11:10:05 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: Postgresql Performance +Subject: Planner doesn't look at LIMIT? +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.612 tagged_above=0 required=5 tests=AWL, + FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/345 +X-Sequence-Number: 13586 + +Hello, I have PostgreSQL 8.0.3 running on a "workstation" with 768 MB +of RAM, under FreeBSD. And I have a 47-milion row table: + +qnex=3D# explain select * from log; + QUERY PLAN =20 +----------------------------------------------------------------------- + Seq Scan on log (cost=3D0.00..1741852.36 rows=3D47044336 width=3D180) +(1 row) + +...which is joined with a few smaller ones, like: + +qnex=3D# explain select * from useragents; + QUERY PLAN =20 +------------------------------------------------------------------- + Seq Scan on useragents (cost=3D0.00..9475.96 rows=3D364896 width=3D96) +(1 row) + +shared_buffers =3D 5000 +random_page_cost =3D 3 +work_mem =3D 102400 +effective_cache_size =3D 60000 + +Now, if I do a SELECT: + +qnex=3D# EXPLAIN SELECT * FROM log NATURAL JOIN useragents LIMIT 1; + QUERY PLAN +---------------------------------------------------------------------------= +---------- + Limit (cost=3D15912.20..15912.31 rows=3D1 width=3D272) + -> Hash Join (cost=3D15912.20..5328368.96 rows=3D47044336 width=3D272) + Hash Cond: ("outer".useragent_id =3D "inner".useragent_id) + -> Seq Scan on log (cost=3D0.00..1741852.36 rows=3D47044336 widt= +h=3D180) + -> Hash (cost=3D9475.96..9475.96 rows=3D364896 width=3D96) + -> Seq Scan on useragents (cost=3D0.00..9475.96 +rows=3D364896 width=3D96) +(6 rows) + +Or: + +qnex=3D# EXPLAIN SELECT * FROM log NATURAL LEFT JOIN useragents LIMIT 1; + QUERY PLAN +---------------------------------------------------------------------------= +---------- + Limit (cost=3D15912.20..15912.31 rows=3D1 width=3D272) + -> Hash Left Join (cost=3D15912.20..5328368.96 rows=3D47044336 width= +=3D272) + Hash Cond: ("outer".useragent_id =3D "inner".useragent_id) + -> Seq Scan on log (cost=3D0.00..1741852.36 rows=3D47044336 widt= +h=3D180) + -> Hash (cost=3D9475.96..9475.96 rows=3D364896 width=3D96) + -> Seq Scan on useragents (cost=3D0.00..9475.96 +rows=3D364896 width=3D96) +(6 rows) + +Time: 2.688 ms + +...the query seems to last forever (its hashing 47 million rows!) + +If I set enable_hashjoin=3Dfalse: + +qnex=3D# EXPLAIN ANALYZE SELECT * FROM log NATURAL LEFT JOIN useragents LIM= +IT 1; + QUERY +PLAN +---------------------------------------------------------------------------= +---------------------------------------------------------------- + Limit (cost=3D0.00..3.07 rows=3D1 width=3D272) (actual time=3D74.214..74.= +216 +rows=3D1 loops=3D1) + -> Nested Loop Left Join (cost=3D0.00..144295895.01 rows=3D47044336 +width=3D272) (actual time=3D74.204..74.204 rows=3D1 loops=3D1) + -> Seq Scan on log (cost=3D0.00..1741852.36 rows=3D47044336 +width=3D180) (actual time=3D23.270..23.270 rows=3D1 loops=3D1) + -> Index Scan using useragents_pkey on useragents=20 +(cost=3D0.00..3.02 rows=3D1 width=3D96) (actual time=3D50.867..50.867 rows= +=3D1 +loops=3D1) + Index Cond: ("outer".useragent_id =3D useragents.useragent_i= +d) + Total runtime: 74.483 ms + +...which is way faster. Of course if I did: + +qnex=3D# EXPLAIN ANALYZE SELECT * FROM log NATURAL LEFT JOIN useragents +WHERE logid =3D (SELECT logid FROM log LIMIT 1); + QUERY PLAN +---------------------------------------------------------------------------= +-------------------------------------------------------- + Nested Loop Left Join (cost=3D0.04..6.09 rows=3D1 width=3D272) (actual +time=3D61.403..61.419 rows=3D1 loops=3D1) + InitPlan + -> Limit (cost=3D0.00..0.04 rows=3D1 width=3D4) (actual +time=3D0.029..0.032 rows=3D1 loops=3D1) + -> Seq Scan on log (cost=3D0.00..1741852.36 rows=3D47044336 +width=3D4) (actual time=3D0.023..0.023 rows=3D1 loops=3D1) + -> Index Scan using log_pkey on log (cost=3D0.00..3.02 rows=3D1 +width=3D180) (actual time=3D61.316..61.319 rows=3D1 loops=3D1) + Index Cond: (logid =3D $0) + -> Index Scan using useragents_pkey on useragents=20 +(cost=3D0.00..3.02 rows=3D1 width=3D96) (actual time=3D0.036..0.042 rows=3D= +1 +loops=3D1) + Index Cond: ("outer".useragent_id =3D useragents.useragent_id) + Total runtime: 61.741 ms +(9 rows) + +...I tried tweaking cpu_*, work_mem, effective_cache and so on, but without +any luck. 47 milion table is huge compared to useragents (I actually need +to join the log with 3 similar to useragents tables, and create a view out +of it). Also tried using LEFT/RIGHT JOINS insead of (inner) JOINs... +Of course the database is freshly vacuum analyzed, and statistics are +set at 50... + +My view of the problem is that planner ignores the "LIMIT" part. It assume= +s +it _needs_ to return all 47 million rows joined with the useragents table, = +so +the hashjoin is the only sane approach. But chances are that unless I'll +use LIMIT 200000, the nested loop will be much faster. + +Any ideas how to make it work (other than rewriting the query to use +subselects, use explicit id-rows, disabling hashjoin completely)? +Or is this a bug? + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Fri Jul 22 10:17:54 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6487F528B7 + for ; + Fri, 22 Jul 2005 10:17:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81156-04 + for ; + Fri, 22 Jul 2005 13:16:56 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 8548A5284E + for ; + Fri, 22 Jul 2005 10:16:54 -0300 (ADT) +Received: (qmail 2673 invoked from network); 22 Jul 2005 15:16:58 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 22 Jul 2005 15:16:58 +0200 +To: "Dawid Kuroczko" , + "Postgresql Performance" +Subject: Re: Planner doesn't look at LIMIT? +References: <758d5e7f0507220210bfa4978@mail.gmail.com> +Message-ID: +Date: Fri, 22 Jul 2005 15:16:57 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <758d5e7f0507220210bfa4978@mail.gmail.com> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/346 +X-Sequence-Number: 13587 + + + Which row do you want ? Do you want 'a row' at random ? + I presume you want the N latest rows ? + In that case you should use an ORDER BY on an indexed field, the serial +primary key will do nicely (ORDER BY id DESC) ; it's indexed so it will +use the index and it will fly. + +> Any ideas how to make it work (other than rewriting the query to use +> subselects, use explicit id-rows, disabling hashjoin completely)? +> Or is this a bug? +> +> Regards, +> Dawid +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: In versions below 8.0, the planner will ignore your desire to +> choose an index scan if your joining column's datatypes do not +> match +> + + + +From pgsql-performance-owner@postgresql.org Fri Jul 22 11:40:00 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8372A52896 + for ; + Fri, 22 Jul 2005 11:39:58 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01385-06 + for ; + Fri, 22 Jul 2005 14:39:56 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A57145288B + for ; + Fri, 22 Jul 2005 11:39:54 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6MEdvbu029474; + Fri, 22 Jul 2005 10:39:57 -0400 (EDT) +To: Dawid Kuroczko +Cc: Postgresql Performance +Subject: Re: Planner doesn't look at LIMIT? +In-reply-to: <758d5e7f0507220210bfa4978@mail.gmail.com> +References: <758d5e7f0507220210bfa4978@mail.gmail.com> +Comments: In-reply-to Dawid Kuroczko + message dated "Fri, 22 Jul 2005 11:10:05 +0200" +Date: Fri, 22 Jul 2005 10:39:57 -0400 +Message-ID: <29473.1122043197@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/347 +X-Sequence-Number: 13588 + +Dawid Kuroczko writes: +> qnex=# EXPLAIN SELECT * FROM log NATURAL JOIN useragents LIMIT 1; + +> Limit (cost=15912.20..15912.31 rows=1 width=272) +> -> Hash Join (cost=15912.20..5328368.96 rows=47044336 width=272) + +> If I set enable_hashjoin=false: + +> qnex=# EXPLAIN ANALYZE SELECT * FROM log NATURAL LEFT JOIN useragents LIMIT 1; + +> Limit (cost=0.00..3.07 rows=1 width=272) (actual time=74.214..74.216 +> rows=1 loops=1) +> -> Nested Loop Left Join (cost=0.00..144295895.01 rows=47044336 +> width=272) (actual time=74.204..74.204 rows=1 loops=1) + +This is quite strange. The nestloop plan definitely should be preferred +in the context of the LIMIT, considering that it has far lower estimated +cost. And it is preferred in simple tests for me. It seems there must +be something specific to your installation that's causing the planner to +go wrong. Can you develop a self-contained test case that behaves this +way for you? + +I recall we saw a similar complaint a month or two back, but the +complainant never followed up with anything useful for tracking down +the problem. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jul 22 11:48:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9742C52896 + for ; + Fri, 22 Jul 2005 11:48:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04076-05 + for ; + Fri, 22 Jul 2005 14:48:10 +0000 (GMT) +Received: from tomts40-srv.bellnexxia.net (unknown [209.226.175.97]) + by svr1.postgresql.org (Postfix) with ESMTP id 820D552869 + for ; + Fri, 22 Jul 2005 11:48:08 -0300 (ADT) +Received: from [192.168.1.99] ([206.172.223.162]) by + tomts40-srv.bellnexxia.net + (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP + id <20050722144806.CIZI1799.tomts40-srv.bellnexxia.net@[192.168.1.99]> + for ; + Fri, 22 Jul 2005 10:48:06 -0400 +Message-ID: <42E106D2.5080604@alteeve.com> +Date: Fri, 22 Jul 2005 10:46:42 -0400 +From: Madison Kelly +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 +X-Accept-Language: en-us, en, ja +MIME-Version: 1.0 +To: pgsqlperform +Subject: Another index question +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/348 +X-Sequence-Number: 13589 + +Hi all, + + I am trying to do an update on a table but so far I can't seem to +come up with a usable index. After my last question/thread the user +'PFC' recommended I store whether a file was to be backed up as either +'t'(rue), 'f'(alse) or 'i'(nherit) to speed up changing files and sub +directories under a given directory when it was toggled. I've more or +less finished implementing this and it is certainly a LOT faster but I +am hoping to make it just a little faster still with an Index. + + Tom Lane pointed out to me that I needed 'text_pattern_ops' on my +'file_parent_dir' column in the index if I wanted to do pattern matching +(the C locale wasn't set). Now I have added an additional condition and +I think this might be my problem. Here is a sample query I am trying to +create my index for: + + +UPDATE file_info_2 SET file_backup='i' WHERE file_backup!='i' AND +file_parent_dir='/'; + + This would be an example of someone changing the backup state of the +root of a partition. It could also be: + + +UPDATE file_info_2 SET file_backup='i' WHERE file_backup!='i' AND +file_parent_dir='/usr'; + + If, for example, the user was toggling the backup state of the '/usr' +directory. + + I suspected that because I was using "file_backup!='i'" that maybe I +was running into the same problem as before so I tried creating the index: + + +tle-bu=> CREATE INDEX file_info_2_mupdate_idx ON file_info_2 +(file_backup bpchar_pattern_ops, file_parent_dir text_pattern_ops); + +tle-bu=> EXPLAIN ANALYZE UPDATE file_info_2 SET file_backup='i' WHERE +file_backup!='i' AND file_parent_dir~'^/'; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------- + Seq Scan on file_info_2 (cost=0.00..13379.38 rows=1 width=134) +(actual time=1623.819..1624.087 rows=4 loops=1) + Filter: ((file_backup <> 'i'::bpchar) AND (file_parent_dir ~ +'^/'::text)) + Total runtime: 1628.053 ms +(3 rows) + + + This index wasn't used though, even when I set 'enable_seqscan' to +'OFF'. The column 'file_backup' is 'char(1)' and the column +'file_parent_dir' is 'text'. + + +tle-bu=> \d file_info_2; \di file_info_2_mupdate_idx; +Table "public.file_info_2" + Column | Type | Modifiers +-----------------+--------------+------------------------------ + file_group_name | text | + file_group_uid | integer | not null + file_mod_time | bigint | not null + file_name | text | not null + file_parent_dir | text | not null + file_perm | integer | not null + file_size | bigint | not null + file_type | character(1) | not null + file_user_name | text | + file_user_uid | integer | not null + file_backup | character(1) | not null default 'i'::bpchar + file_display | character(1) | not null default 'i'::bpchar + file_restore | character(1) | not null default 'i'::bpchar +Indexes: + "file_info_2_mupdate_idx" btree (file_backup bpchar_pattern_ops, +file_parent_dir text_pattern_ops) + "file_info_2_supdate_idx" btree (file_parent_dir, file_name, file_type) + + List of relations + Schema | Name | Type | Owner | Table +--------+-------------------------+-------+---------+------------- + public | file_info_2_mupdate_idx | index | madison | file_info_2 +(1 row) + + Could it be that there needs to be a certain number of +"file_backup!='i'" before the planner will use the index? I have also +tried not defining an op_class on both tables (and one at a time) but I +can't seem to figure this out. + + As always, thank you! + +Madison + +From pgsql-performance-owner@postgresql.org Fri Jul 22 11:51:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1741D528D7 + for ; + Fri, 22 Jul 2005 11:51:35 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04076-08 + for ; + Fri, 22 Jul 2005 14:51:17 +0000 (GMT) +Received: from colo.samason.me.uk (unknown [69.55.228.22]) + by svr1.postgresql.org (Postfix) with ESMTP id 5FCE25288B + for ; + Fri, 22 Jul 2005 11:51:17 -0300 (ADT) +Received: from colo.samason.me.uk (colo [69.55.228.22]) + by colo.samason.me.uk (8.12.11/8.12.11) with ESMTP id j6MEpMQo038585 + for ; + Fri, 22 Jul 2005 15:51:22 +0100 (BST) + (envelope-from sam@colo.samason.me.uk) +Received: (from sam@localhost) + by colo.samason.me.uk (8.12.11/8.12.11/Submit) id j6MEpM8S038584 + for pgsql-performance@postgresql.org; + Fri, 22 Jul 2005 15:51:22 +0100 (BST) (envelope-from sam) +Date: Fri, 22 Jul 2005 15:51:22 +0100 +From: Sam Mason +To: Postgresql Performance +Subject: Re: Planner doesn't look at LIMIT? +Message-ID: <20050722145122.GL62747@colo.samason.me.uk> +Mail-Followup-To: Sam Mason , + Postgresql Performance +References: <758d5e7f0507220210bfa4978@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <758d5e7f0507220210bfa4978@mail.gmail.com> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/349 +X-Sequence-Number: 13590 + +Dawid Kuroczko wrote: +>work_mem = 102400 + +>...I tried tweaking cpu_*, work_mem, effective_cache and so on, but without +>any luck. + +I'm hoping you didn't tweak it enough! I posted something similar +this a while ago, but haven't since got around to figuring out +a useful test case to send to the list. + +Try reducing your work_mem down to 1000 or so and things should +start doing what you expect. + + + Sam + +From pgsql-patches-owner@postgresql.org Fri Jul 22 12:03:05 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2A8A352803 + for ; + Fri, 22 Jul 2005 12:03:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08825-04 + for ; + Fri, 22 Jul 2005 15:02:57 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 5A2E8528D9 + for ; + Fri, 22 Jul 2005 12:02:57 -0300 (ADT) +Received: from [192.168.1.100] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j6MF2Zhr029333; Fri, 22 Jul 2005 08:02:35 -0700 +Message-ID: <42E10AC0.1080905@commandprompt.com> +Date: Fri, 22 Jul 2005 08:03:28 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Luke Lonergan +Cc: Mark Wong , Andrew Dunstan , + Alvaro Herrera , + Bruce Momjian , + Alon Goldshuv , + pgsql-patches@postgresql.org, maryedie@osdl.org +Subject: Re: COPY FROM performance improvements +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/433 +X-Sequence-Number: 16773 + +Luke Lonergan wrote: +> Joshua, +> +> On 7/21/05 7:53 PM, "Joshua D. Drake" wrote: +> +>>Well I know that isn't true at least not with ANY of the Dells my +>>customers have purchased in the last 18 months. They are still really, +>>really slow. +> +> +> That's too bad, can you cite some model numbers? SCSI? + +Yeah I will get them and post, but yes they are all SCSI. + +> +> +>>I have great success with Silicon Image as long as I am running them +>>with Linux software RAID. The LSI controllers are also really nice. +> +> +> That's good to hear, I gave up on Silicon Image controllers on Linux about 1 +> year ago, which kernel are you using with success? + +Any of the 2.6 kernels. ALso the laster 2.4 (+22 I believe) support it +pretty well as well. + + Silicon Image +> controllers are the most popular, so it's important to see them supported +> well, though I'd rather see more SATA headers than 2 off of the built-in +> chipsets. +> +> - Luke +> + + +-- +Your PostgreSQL solutions provider, Command Prompt, Inc. +24x7 support - 1.800.492.2240, programming, and consulting +Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit +http://www.commandprompt.com / http://www.postgresql.org + +From pgsql-performance-owner@postgresql.org Fri Jul 22 12:11:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0C79E528C0 + for ; + Fri, 22 Jul 2005 12:11:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06881-10 + for ; + Fri, 22 Jul 2005 15:11:03 +0000 (GMT) +Received: from tomts5-srv.bellnexxia.net (tomts5.bellnexxia.net + [209.226.175.25]) + by svr1.postgresql.org (Postfix) with ESMTP id CD39F52896 + for ; + Fri, 22 Jul 2005 12:10:59 -0300 (ADT) +Received: from [192.168.1.99] ([206.172.171.182]) by tomts5-srv.bellnexxia.net + (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP + id <20050722151057.FOLM26128.tomts5-srv.bellnexxia.net@[192.168.1.99]> + for ; + Fri, 22 Jul 2005 11:10:57 -0400 +Message-ID: <42E10C2C.4040202@alteeve.com> +Date: Fri, 22 Jul 2005 11:09:32 -0400 +From: Madison Kelly +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 +X-Accept-Language: en-us, en, ja +MIME-Version: 1.0 +To: pgsqlperform +Subject: Solved (was: Re: Another index question) +References: <42E106D2.5080604@alteeve.com> +In-Reply-To: <42E106D2.5080604@alteeve.com> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/350 +X-Sequence-Number: 13591 + +Line noise, sorry... + + After posting I went back to reading the pgsql docs and saw the query: + + +SELECT am.amname AS index_method, opc.opcname AS opclass_name, +opr.oprname AS opclass_operator FROM pg_am am, pg_opclass opc, pg_amop +amop, pg_operator opr WHERE opc.opcamid = am.oid AND amop.amopclaid = +opc.oid AND amop.amopopr = opr.oid ORDER BY index_method, opclass_name, +opclass_operator; + + Which listed all the op_classes. I noticed none of the +opclass_operators supported '!=' so I wondered if that was simply an +unindexable (is that a word?) operator. So I tried creating the index: + + +tle-bu=> CREATE INDEX file_info_2_mupdate_idx ON file_info_2 +(file_backup, file_parent_dir text_pattern_ops); + + And changing my query to: + + +tle-bu=> EXPLAIN ANALYZE UPDATE file_info_2 SET file_backup='i' WHERE +file_backup='t' OR file_backup='f' AND file_parent_dir~'^/'; + + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- + Index Scan using file_info_2_mupdate_idx, file_info_2_mupdate_idx on +file_info_2 (cost=0.00..10.04 rows=1 width=134) (actual +time=0.112..0.718 rows=4 loops=1) + Index Cond: ((file_backup = 't'::bpchar) OR ((file_backup = +'f'::bpchar) AND (file_parent_dir ~>=~ '/'::text) AND (file_parent_dir +~<~ '0'::text))) + Filter: ((file_backup = 't'::bpchar) OR ((file_backup = 'f'::bpchar) +AND (file_parent_dir ~ '^/'::text))) + Total runtime: 60.359 ms +(4 rows) + + Bingo! + + Hopefully someone might find this useful in the archives. :p + +Madison + + +Madison Kelly wrote: +> Hi all, +> +> I am trying to do an update on a table but so far I can't seem to come +> up with a usable index. After my last question/thread the user 'PFC' +> recommended I store whether a file was to be backed up as either +> 't'(rue), 'f'(alse) or 'i'(nherit) to speed up changing files and sub +> directories under a given directory when it was toggled. I've more or +> less finished implementing this and it is certainly a LOT faster but I +> am hoping to make it just a little faster still with an Index. +> +> Tom Lane pointed out to me that I needed 'text_pattern_ops' on my +> 'file_parent_dir' column in the index if I wanted to do pattern matching +> (the C locale wasn't set). Now I have added an additional condition and +> I think this might be my problem. Here is a sample query I am trying to +> create my index for: +> +> +> UPDATE file_info_2 SET file_backup='i' WHERE file_backup!='i' AND +> file_parent_dir='/'; +> +> This would be an example of someone changing the backup state of the +> root of a partition. It could also be: +> +> +> UPDATE file_info_2 SET file_backup='i' WHERE file_backup!='i' AND +> file_parent_dir='/usr'; +> +> If, for example, the user was toggling the backup state of the '/usr' +> directory. +> +> I suspected that because I was using "file_backup!='i'" that maybe I +> was running into the same problem as before so I tried creating the index: +> +> +> tle-bu=> CREATE INDEX file_info_2_mupdate_idx ON file_info_2 +> (file_backup bpchar_pattern_ops, file_parent_dir text_pattern_ops); +> +> tle-bu=> EXPLAIN ANALYZE UPDATE file_info_2 SET file_backup='i' WHERE +> file_backup!='i' AND file_parent_dir~'^/'; QUERY PLAN +> ----------------------------------------------------------------------------------------------------------------- +> +> Seq Scan on file_info_2 (cost=0.00..13379.38 rows=1 width=134) (actual +> time=1623.819..1624.087 rows=4 loops=1) +> Filter: ((file_backup <> 'i'::bpchar) AND (file_parent_dir ~ +> '^/'::text)) +> Total runtime: 1628.053 ms +> (3 rows) +> +> +> This index wasn't used though, even when I set 'enable_seqscan' to +> 'OFF'. The column 'file_backup' is 'char(1)' and the column +> 'file_parent_dir' is 'text'. +> +> +> tle-bu=> \d file_info_2; \di file_info_2_mupdate_idx; Table +> "public.file_info_2" +> Column | Type | Modifiers +> -----------------+--------------+------------------------------ +> file_group_name | text | +> file_group_uid | integer | not null +> file_mod_time | bigint | not null +> file_name | text | not null +> file_parent_dir | text | not null +> file_perm | integer | not null +> file_size | bigint | not null +> file_type | character(1) | not null +> file_user_name | text | +> file_user_uid | integer | not null +> file_backup | character(1) | not null default 'i'::bpchar +> file_display | character(1) | not null default 'i'::bpchar +> file_restore | character(1) | not null default 'i'::bpchar +> Indexes: +> "file_info_2_mupdate_idx" btree (file_backup bpchar_pattern_ops, +> file_parent_dir text_pattern_ops) +> "file_info_2_supdate_idx" btree (file_parent_dir, file_name, file_type) +> +> List of relations +> Schema | Name | Type | Owner | Table +> --------+-------------------------+-------+---------+------------- +> public | file_info_2_mupdate_idx | index | madison | file_info_2 +> (1 row) +> +> Could it be that there needs to be a certain number of +> "file_backup!='i'" before the planner will use the index? I have also +> tried not defining an op_class on both tables (and one at a time) but I +> can't seem to figure this out. +> +> As always, thank you! +> +> Madison + +From pgsql-performance-owner@postgresql.org Fri Jul 22 13:09:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9655F5297E + for ; + Fri, 22 Jul 2005 13:09:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 29777-01 + for ; + Fri, 22 Jul 2005 16:09:40 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.207]) + by svr1.postgresql.org (Postfix) with ESMTP id E8DFF5282F + for ; + Fri, 22 Jul 2005 13:09:36 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id x3so234625nzd + for ; + Fri, 22 Jul 2005 09:09:37 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=pWOPRiwqOkO5qXHAKdUUOSISG7INoiC7PyFZzp1QNhVUh8rCDsaR8JHEf8l6PyQQIj5AaYpyU8HYcMtlmXwjFqCltIxLEy485tOHnxPS5YijYa7ZS9xwBt42+yhtSlRKOXQRfVujZ8x/7EFBGEVJAAscPs+ayv+jj2ZOvoQO7nM= +Received: by 10.36.3.7 with SMTP id 7mr1584052nzc; + Fri, 22 Jul 2005 09:09:37 -0700 (PDT) +Received: by 10.36.22.20 with HTTP; Fri, 22 Jul 2005 09:09:37 -0700 (PDT) +Message-ID: <758d5e7f05072209094156c984@mail.gmail.com> +Date: Fri, 22 Jul 2005 18:09:37 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: Tom Lane +Subject: Re: Planner doesn't look at LIMIT? +Cc: Postgresql Performance +In-Reply-To: <29473.1122043197@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: <758d5e7f0507220210bfa4978@mail.gmail.com> + <29473.1122043197@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.612 tagged_above=0 required=5 tests=AWL, + FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/351 +X-Sequence-Number: 13592 + +On 7/22/05, Tom Lane wrote: +> Dawid Kuroczko writes: +> > qnex=3D# EXPLAIN SELECT * FROM log NATURAL JOIN useragents LIMIT 1; +>=20 +> > Limit (cost=3D15912.20..15912.31 rows=3D1 width=3D272) +> > -> Hash Join (cost=3D15912.20..5328368.96 rows=3D47044336 width=3D= +272) +>=20 +> This is quite strange. The nestloop plan definitely should be preferred +> in the context of the LIMIT, considering that it has far lower estimated +> cost. And it is preferred in simple tests for me. It seems there must +> be something specific to your installation that's causing the planner to +> go wrong. Can you develop a self-contained test case that behaves this +> way for you? + +Why, certainly. I did test it also on Gentoo Linux PostgreSQL 8.0.1 (yeah, +a bit older one), but the behaviour is the same. The test looks like this: + +-- First lets make a "small" lookup table -- 400000 rows. +CREATE TABLE lookup ( + lookup_id serial PRIMARY KEY, + value integer NOT NULL +); +INSERT INTO lookup (value) SELECT * FROM generate_series(1, 400000); +VACUUM ANALYZE lookup; +-- Then lets make a huge data table... +CREATE TABLE huge_data ( + huge_data_id serial PRIMARY KEY, + lookup_id integer NOT NULL +); +INSERT INTO huge_data (lookup_id) SELECT lookup_id FROM lookup; +INSERT INTO huge_data (lookup_id) SELECT lookup_id FROM huge_data; -- 80= +0 000 +INSERT INTO huge_data (lookup_id) SELECT lookup_id FROM huge_data; -- 1 60= +0 000 +INSERT INTO huge_data (lookup_id) SELECT lookup_id FROM huge_data; -- 3 20= +0 000 +INSERT INTO huge_data (lookup_id) SELECT lookup_id FROM huge_data; -- 6 40= +0 000 +INSERT INTO huge_data (lookup_id) SELECT lookup_id FROM huge_data; -- 12 80= +0 000 +-- You may want to put ANALYZE and EXPLAIN between each of these +-- steps. In my cases, at 12.8 mln rows PostgreSQL seems to go for hashjoi= +n +-- in each case. YMMV, so you may try to push it up to 1024 mln rows. +INSERT INTO huge_data (lookup_id) SELECT lookup_id FROM huge_data; -- 25 60= +0 000 +ANALYZE huge_data; +EXPLAIN SELECT * FROM huge_data NATURAL JOIN lookup LIMIT 1; + +My EXPLAIN FROM Linux (SMP P-III box), with PostgreSQL 8.0.1, during making +this test case: + +qnex=3D# EXPLAIN SELECT * FROM huge_data NATURAL JOIN lookup LIMIT 1; + QUERY PLAN +---------------------------------------------------------------------------= +--------- +Limit (cost=3D0.00..3.21 rows=3D1 width=3D12) + -> Nested Loop (cost=3D0.00..19557596.04 rows=3D6094777 width=3D12) + -> Seq Scan on huge_data (cost=3D0.00..95372.42 rows=3D6399942 wi= +dth=3D8) + -> Index Scan using lookup_pkey on lookup (cost=3D0.00..3.02 +rows=3D1 width=3D8) + Index Cond: ("outer".lookup_id =3D lookup.lookup_id) +(5 rows) + +Time: 4,333 ms +qnex=3D# INSERT INTO huge_data (lookup_id) SELECT lookup_id FROM +huge_data; -- 12 800 000 +INSERT 0 6400000 +Time: 501014,692 ms +qnex=3D# ANALYZE huge_data; +ANALYZE +Time: 4243,453 ms +qnex=3D# EXPLAIN SELECT * FROM huge_data NATURAL JOIN lookup LIMIT 1; + QUERY PLAN +---------------------------------------------------------------------------= +---- +Limit (cost=3D11719.00..11719.09 rows=3D1 width=3D12) + -> Hash Join (cost=3D11719.00..1212739.73 rows=3D12800185 width=3D12) + Hash Cond: ("outer".lookup_id =3D "inner".lookup_id) + -> Seq Scan on huge_data (cost=3D0.00..190747.84 rows=3D12800184 = +width=3D8) + -> Hash (cost=3D5961.00..5961.00 rows=3D400000 width=3D8) + -> Seq Scan on lookup (cost=3D0.00..5961.00 rows=3D400000 w= +idth=3D8) +(6 rows) + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Fri Jul 22 13:20:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7F3CD52840; + Fri, 22 Jul 2005 13:20:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31810-06; Fri, 22 Jul 2005 16:20:23 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 92C4152846; + Fri, 22 Jul 2005 13:20:21 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6MGKKl2006441; + Fri, 22 Jul 2005 12:20:20 -0400 (EDT) +To: Dawid Kuroczko +Cc: pgsql-performance@postgreSQL.org, pgsql-hackers@postgreSQL.org +Subject: Re: Planner doesn't look at LIMIT? +In-reply-to: <29473.1122043197@sss.pgh.pa.us> +References: <758d5e7f0507220210bfa4978@mail.gmail.com> + <29473.1122043197@sss.pgh.pa.us> +Comments: In-reply-to Tom Lane + message dated "Fri, 22 Jul 2005 10:39:57 -0400" +Date: Fri, 22 Jul 2005 12:20:20 -0400 +Message-ID: <6440.1122049220@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/352 +X-Sequence-Number: 13593 + +I wrote: +> Dawid Kuroczko writes: +>> qnex=# EXPLAIN SELECT * FROM log NATURAL JOIN useragents LIMIT 1; + +>> Limit (cost=15912.20..15912.31 rows=1 width=272) +>> -> Hash Join (cost=15912.20..5328368.96 rows=47044336 width=272) + +>> If I set enable_hashjoin=false: + +>> qnex=# EXPLAIN ANALYZE SELECT * FROM log NATURAL LEFT JOIN useragents LIMIT 1; + +>> Limit (cost=0.00..3.07 rows=1 width=272) (actual time=74.214..74.216 +>> rows=1 loops=1) +>> -> Nested Loop Left Join (cost=0.00..144295895.01 rows=47044336 +>> width=272) (actual time=74.204..74.204 rows=1 loops=1) + +> This is quite strange. The nestloop plan definitely should be preferred +> in the context of the LIMIT, considering that it has far lower estimated +> cost. And it is preferred in simple tests for me. + +After a suitable period of contemplating my navel, I figured out +what is going on here: the total costs involved are large enough that +the still-fairly-high startup cost of the hash is disregarded by +compare_fuzzy_path_costs(), and so the nestloop is discarded as not +having any significant potential advantage in startup time. + +I think that this refutes the original scheme of using the same fuzz +factor for both startup and total cost comparisons, and therefore +propose the attached patch. + +Comments? + + regards, tom lane + +*** src/backend/optimizer/util/pathnode.c.orig Fri Jul 15 13:09:25 2005 +--- src/backend/optimizer/util/pathnode.c Fri Jul 22 12:08:25 2005 +*************** +*** 98,157 **** + static int + compare_fuzzy_path_costs(Path *path1, Path *path2, CostSelector criterion) + { +- Cost fuzz; +- + /* +! * The fuzz factor is set at one percent of the smaller total_cost, +! * but not less than 0.01 cost units (just in case total cost is +! * zero). + * + * XXX does this percentage need to be user-configurable? + */ +- fuzz = Min(path1->total_cost, path2->total_cost) * 0.01; +- fuzz = Max(fuzz, 0.01); +- + if (criterion == STARTUP_COST) + { +! if (Abs(path1->startup_cost - path2->startup_cost) > fuzz) +! { +! if (path1->startup_cost < path2->startup_cost) +! return -1; +! else +! return +1; +! } + + /* + * If paths have the same startup cost (not at all unlikely), + * order them by total cost. + */ +! if (Abs(path1->total_cost - path2->total_cost) > fuzz) +! { +! if (path1->total_cost < path2->total_cost) +! return -1; +! else +! return +1; +! } + } + else + { +! if (Abs(path1->total_cost - path2->total_cost) > fuzz) +! { +! if (path1->total_cost < path2->total_cost) +! return -1; +! else +! return +1; +! } + + /* + * If paths have the same total cost, order them by startup cost. + */ +! if (Abs(path1->startup_cost - path2->startup_cost) > fuzz) +! { +! if (path1->startup_cost < path2->startup_cost) +! return -1; +! else +! return +1; +! } + } + return 0; + } +--- 98,138 ---- + static int + compare_fuzzy_path_costs(Path *path1, Path *path2, CostSelector criterion) + { + /* +! * We use a fuzz factor of 1% of the smaller cost. + * + * XXX does this percentage need to be user-configurable? + */ + if (criterion == STARTUP_COST) + { +! if (path1->startup_cost > path2->startup_cost * 1.01) +! return +1; +! if (path2->startup_cost > path1->startup_cost * 1.01) +! return -1; + + /* + * If paths have the same startup cost (not at all unlikely), + * order them by total cost. + */ +! if (path1->total_cost > path2->total_cost * 1.01) +! return +1; +! if (path2->total_cost > path1->total_cost * 1.01) +! return -1; + } + else + { +! if (path1->total_cost > path2->total_cost * 1.01) +! return +1; +! if (path2->total_cost > path1->total_cost * 1.01) +! return -1; + + /* + * If paths have the same total cost, order them by startup cost. + */ +! if (path1->startup_cost > path2->startup_cost * 1.01) +! return +1; +! if (path2->startup_cost > path1->startup_cost * 1.01) +! return -1; + } + return 0; + } + +From pgsql-patches-owner@postgresql.org Fri Jul 22 13:49:25 2005 +X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6F81652997 + for ; + Fri, 22 Jul 2005 13:49:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40405-08 + for ; + Fri, 22 Jul 2005 16:49:21 +0000 (GMT) +Received: from henry.newn.cam.ac.uk (henry.newn.cam.ac.uk [131.111.204.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8AC305282F + for ; + Fri, 22 Jul 2005 13:49:20 -0300 (ADT) +Received: from quartz.newn.cam.ac.uk ([131.111.204.180]) + by henry.newn.cam.ac.uk with esmtp (Exim 4.20) + id 1Dw0ht-0003Uz-OX; Fri, 22 Jul 2005 17:49:05 +0100 +Received: from prlw1 by quartz.newn.cam.ac.uk with local (Exim 4.20) + id 1Dw0ht-00041x-Kl; Fri, 22 Jul 2005 17:49:05 +0100 +Date: Fri, 22 Jul 2005 17:49:05 +0100 +From: Patrick Welche +To: Luke Lonergan +Cc: "Joshua D. Drake" , + Mark Wong , Andrew Dunstan , + Alvaro Herrera , + Bruce Momjian , + Alon Goldshuv , + pgsql-patches@postgresql.org, maryedie@osdl.org +Subject: Re: COPY FROM performance improvements +Message-ID: <20050722164905.GE18413@quartz.newn.cam.ac.uk> +References: <42E05FAF.70601@commandprompt.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/436 +X-Sequence-Number: 16776 + +On Thu, Jul 21, 2005 at 09:19:04PM -0700, Luke Lonergan wrote: +> Joshua, +> +> On 7/21/05 7:53 PM, "Joshua D. Drake" wrote: +> > Well I know that isn't true at least not with ANY of the Dells my +> > customers have purchased in the last 18 months. They are still really, +> > really slow. +> +> That's too bad, can you cite some model numbers? SCSI? + +I would be interested too, given + + http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=30531 + + +Cheers, + +Patrick + +From pgsql-performance-owner@postgresql.org Fri Jul 22 14:12:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6791E528AD + for ; + Fri, 22 Jul 2005 14:12:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55128-01 + for ; + Fri, 22 Jul 2005 17:12:02 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id A510852858 + for ; + Fri, 22 Jul 2005 14:12:02 -0300 (ADT) +Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j6MHBLhr009212; Fri, 22 Jul 2005 10:11:22 -0700 +Message-ID: <42E128BD.2000104@commandprompt.com> +Date: Fri, 22 Jul 2005 10:11:25 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Patrick Welche +Cc: Luke Lonergan , + Mark Wong , Andrew Dunstan , + Alvaro Herrera , + Bruce Momjian , + Alon Goldshuv , + pgsql-performance@postgresql.org, maryedie@osdl.org +Subject: Re: [PATCHES] COPY FROM performance improvements +References: <42E05FAF.70601@commandprompt.com> + + <20050722164905.GE18413@quartz.newn.cam.ac.uk> +In-Reply-To: <20050722164905.GE18413@quartz.newn.cam.ac.uk> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/353 +X-Sequence-Number: 13594 + +Here is the SCSI output: + +Web Server + +SCSI subsystem driver Revision: 1.00 +megaraid: v1.18j (Release Date: Mon Jul 7 14:39:55 EDT 2003) +megaraid: found 0x1028:0x000f:idx 0:bus 4:slot 3:func 0 +scsi0 : Found a MegaRAID controller at 0xf883f000, IRQ: 18 +scsi0 : Enabling 64 bit support +megaraid: [412W:H406] detected 1 logical drives +megaraid: supports extended CDBs. +megaraid: channel[1] is raid. +megaraid: channel[2] is raid. +scsi0 : LSI Logic MegaRAID 412W 254 commands 15 targs 5 chans 7 luns + + +Database Server + +SCSI subsystem driver Revision: 1.00 +megaraid: v1.18j (Release Date: Mon Jul 7 14:39:55 EDT 2003) +megaraid: found 0x101e:0x1960:idx 0:bus 5:slot 0:func 0 +scsi0 : Found a MegaRAID controller at 0xf883f000, IRQ: 21 +scsi0 : Enabling 64 bit support +megaraid: [196T:3.33] detected 1 logical drives +megaraid: supports extended CDBs. +megaraid: channel[1] is raid. +megaraid: channel[2] is raid. +scsi0 : LSI Logic MegaRAID 196T 254 commands 15 targs 5 chans 7 luns +Starting timer : 0 0 +blk: queue c5f2d218, I/O limit 4095Mb (mask 0xffffffff) +scsi0: scanning virtual channel 0 for logical drives. + Vendor: MegaRAID Model: LD 0 RAID5 86G Rev: 196T + Type: Direct-Access ANSI SCSI revision: 02 +Starting timer : 0 0 + + +The webserver is a 1U and it actually performs better on the IO than the +database server even though the database server is running 6 disks versus 3. + +The database server is a PE (Power Edge) 6600 + +Database Server IO: + +[root@master root]# /sbin/hdparm -tT /dev/sda + +/dev/sda: + Timing buffer-cache reads: 1888 MB in 2.00 seconds = 944.00 MB/sec + Timing buffered disk reads: 32 MB in 3.06 seconds = 10.46 MB/sec + +Second Database Server IO: + +[root@pq-slave root]# /sbin/hdparm -tT /dev/sda + +/dev/sda: + Timing buffer-cache reads: 1816 MB in 2.00 seconds = 908.00 MB/sec + Timing buffered disk reads: 26 MB in 3.11 seconds = 8.36 MB/sec +[root@pq-slave root]# + +Which is just horrible. + + +Sincerely, + +Joshua D. Drake + + + + + + +Patrick Welche wrote: +> On Thu, Jul 21, 2005 at 09:19:04PM -0700, Luke Lonergan wrote: +> +>>Joshua, +>> +>>On 7/21/05 7:53 PM, "Joshua D. Drake" wrote: +>> +>>>Well I know that isn't true at least not with ANY of the Dells my +>>>customers have purchased in the last 18 months. They are still really, +>>>really slow. +>> +>>That's too bad, can you cite some model numbers? SCSI? +> +> +> I would be interested too, given +> +> http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=30531 +> +> +> Cheers, +> +> Patrick +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Have you searched our list archives? +> +> http://archives.postgresql.org + + +-- +Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 +PostgreSQL Replication, Consulting, Custom Programming, 24x7 support +Managed Services, Shared and Dedicated Hosting +Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ + +From pgsql-performance-owner@postgresql.org Fri Jul 22 14:32:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B7D06529BF; + Fri, 22 Jul 2005 14:32:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59657-03; Fri, 22 Jul 2005 17:32:05 +0000 (GMT) +Received: from cmailg4.svr.pol.co.uk (cmailg4.svr.pol.co.uk [195.92.195.174]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C5425293D; + Fri, 22 Jul 2005 14:32:04 -0300 (ADT) +Received: from modem-3356.lynx.dialup.pol.co.uk ([217.135.205.28] + helo=192.168.0.102) by cmailg4.svr.pol.co.uk with esmtp (Exim 4.41) + id 1Dw1NS-0006CU-Ny; Fri, 22 Jul 2005 18:32:02 +0100 +Subject: Re: [HACKERS] Planner doesn't look at LIMIT? +From: Simon Riggs +To: Tom Lane +Cc: Dawid Kuroczko , + pgsql-performance@postgreSQL.org, pgsql-hackers@postgreSQL.org +In-Reply-To: <6440.1122049220@sss.pgh.pa.us> +References: <758d5e7f0507220210bfa4978@mail.gmail.com> + <29473.1122043197@sss.pgh.pa.us> <6440.1122049220@sss.pgh.pa.us> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Fri, 22 Jul 2005 18:31:58 +0100 +Message-Id: <1122053518.21502.180.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/354 +X-Sequence-Number: 13595 + +On Fri, 2005-07-22 at 12:20 -0400, Tom Lane wrote: +> I think that this refutes the original scheme of using the same fuzz +> factor for both startup and total cost comparisons, and therefore +> propose the attached patch. +> +> Comments? + +Looks good. I think it explains a few other wierd perf reports also. + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Fri Jul 22 15:06:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 783EF529BC; + Fri, 22 Jul 2005 15:06:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66823-02; Fri, 22 Jul 2005 18:06:21 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0670B52806; + Fri, 22 Jul 2005 15:06:20 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6MI6HT8007215; + Fri, 22 Jul 2005 14:06:17 -0400 (EDT) +To: Simon Riggs +Cc: Dawid Kuroczko , + pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Planner doesn't look at LIMIT? +In-reply-to: <1122053518.21502.180.camel@localhost.localdomain> +References: <758d5e7f0507220210bfa4978@mail.gmail.com> + <29473.1122043197@sss.pgh.pa.us> <6440.1122049220@sss.pgh.pa.us> + <1122053518.21502.180.camel@localhost.localdomain> +Comments: In-reply-to Simon Riggs + message dated "Fri, 22 Jul 2005 18:31:58 +0100" +Date: Fri, 22 Jul 2005 14:06:17 -0400 +Message-ID: <7214.1122055577@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/355 +X-Sequence-Number: 13596 + +Simon Riggs writes: +> Looks good. I think it explains a few other wierd perf reports also. + +Could be. I went back to look at Sam Mason's report about three weeks +ago, and it definitely seems to explain his issue. The "fuzzy cost +comparison" logic is new in 8.0 so it hasn't had all that much +testing... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Jul 23 21:41:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DDD1D52910 + for ; + Fri, 22 Jul 2005 16:29:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80971-10 + for ; + Fri, 22 Jul 2005 19:29:16 +0000 (GMT) +Received: from mail.Mi8.com (mail.mi8.com [63.240.6.50]) + by svr1.postgresql.org (Postfix) with ESMTP id C9F4152917 + for ; + Fri, 22 Jul 2005 16:29:12 -0300 (ADT) +Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- GW05 Welcome + to Mi8 Corporation www.Mi8.com); Fri, 22 Jul 2005 15:28:46 -0400 +X-Server-Uuid: E0C866E6-C6CD-48B5-AE61-E57E73CF3CC7 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 22 Jul + 2005 15:28:45 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 22 Jul + 2005 15:28:45 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Fri, 22 Jul 2005 12:28:43 -0700 +Subject: Re: [PATCHES] COPY FROM performance improvements +From: "Luke Lonergan" +To: "Joshua D. Drake" , + "Patrick Welche" +Cc: "Mark Wong" , pgsql-performance@postgresql.org, + maryedie@osdl.org +Message-ID: +In-Reply-To: <42E128BD.2000104@commandprompt.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 22 Jul 2005 19:28:45.0806 (UTC) + FILETIME=[93D0D0E0:01C58EF3] +X-WSS-ID: 6EFF97671M810283011-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, hits=1.574 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/364 +X-Sequence-Number: 13605 + +Joshua, + +On 7/22/05 10:11 AM, "Joshua D. Drake" wrote: +> The database server is a PE (Power Edge) 6600 +> +> Database Server IO: +> +> [root@master root]# /sbin/hdparm -tT /dev/sda +> +> /dev/sda: +> Timing buffer-cache reads: 1888 MB in 2.00 seconds = 944.00 MB/sec +> Timing buffered disk reads: 32 MB in 3.06 seconds = 10.46 MB/sec +> +> Second Database Server IO: +> +> [root@pq-slave root]# /sbin/hdparm -tT /dev/sda +> +> /dev/sda: +> Timing buffer-cache reads: 1816 MB in 2.00 seconds = 908.00 MB/sec +> Timing buffered disk reads: 26 MB in 3.11 seconds = 8.36 MB/sec +> [root@pq-slave root]# + +Can you post the "time dd if=/dev/zero of=bigfile bs=8k count=500000" +results? Also do the reverse (read the file) with "time dd if=bigfile +of=/dev/null bs=8k". + +I think you are observing what we've known for a while, hardware RAID is +horribly slow. We've not found a hardware RAID adapter of this class yet +that shows reasonable read or write performance. The Adaptec 2400R or the +LSI or others have terrible internal I/O compared to raw SCSI with software +RAID, and even the CPU usage is higher on these cards while doing slower I/O +than linux SW RAID. + +Notably - we've found that the 3Ware RAID controller does a better job than +the low end SCSI RAID at HW RAID support, and also exports JBOD at high +speeds. If you export JBOD on the low end SCSI RAID adapters, the +performance is also very poor, though generally faster than using HW RAID. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Fri Jul 22 16:47:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E9E00528FD + for ; + Fri, 22 Jul 2005 16:47:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 85752-08 + for ; + Fri, 22 Jul 2005 19:46:58 +0000 (GMT) +Received: from smtp.osdl.org (smtp.osdl.org [65.172.181.4]) + by svr1.postgresql.org (Postfix) with ESMTP id 7558A5291C + for ; + Fri, 22 Jul 2005 16:46:56 -0300 (ADT) +Received: from ibm-b.pdx.osdl.net (fw.osdl.org [65.172.181.6]) + (authenticated bits=0) + by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j6MJkljA024095 + (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); + Fri, 22 Jul 2005 12:46:47 -0700 +Message-Id: <200507221946.j6MJkljA024095@smtp.osdl.org> +Date: Fri, 22 Jul 2005 12:47:18 -0700 +From: Mark Wong +To: "Luke Lonergan" +Cc: "Andrew Dunstan" , + "Alvaro Herrera" , + "Bruce Momjian" , + "Alon Goldshuv" , + pgsql-performance@postgresql.org, maryedie@osdl.org +Subject: Re: [PATCHES] COPY FROM performance improvements +In-Reply-To: +References: <200507212154.j6LLsdjA002847@smtp.osdl.org> + +Organization: OSDL +X-Mailer: Sylpheed-Claws 1.0.4a (GTK+ 1.2.10; i686-pc-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-MIMEDefang-Filter: osdl$Revision: 1.113 $ +X-Scanned-By: MIMEDefang 2.36 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/356 +X-Sequence-Number: 13597 + +On a single spindle: + +$ time dd if=/dev/zero of=bigfile bs=8k count=2000000 +2000000+0 records in +2000000+0 records out + +real 2m8.569s +user 0m0.725s +sys 0m19.633s + +None of my drives are partitioned big enough for me to create 2x RAM +sized files on a single disk. I have 16MB RAM and only 36GB drives. +But here are some number for my 12-disk lvm2 striped volume. + +$ time dd if=/dev/zero of=bigfile3 bs=8k count=4000000 +4000000+0 records in +4000000+0 records out + +real 1m17.059s +user 0m1.479s +sys 0m41.293s + +Mark + +On Thu, 21 Jul 2005 16:14:47 -0700 +"Luke Lonergan" wrote: + +> Cool! +> +> At what rate does your disk setup write sequential data, e.g.: +> time dd if=/dev/zero of=bigfile bs=8k count=500000 +> +> (sized for 2x RAM on a system with 2GB) +> +> BTW - the Compaq smartarray controllers are pretty broken on Linux from a +> performance standpoint in our experience. We've had disastrously bad +> results from the SmartArray 5i and 6 controllers on kernels from 2.4 -> +> 2.6.10, on the order of 20MB/s. +> +> For comparison, the results on our dual opteron with a single LSI SCSI +> controller with software RAID0 on a 2.6.10 kernel: +> +> [llonergan@stinger4 dbfast]$ time dd if=/dev/zero of=bigfile bs=8k +> count=500000 +> 500000+0 records in +> 500000+0 records out +> +> real 0m24.702s +> user 0m0.077s +> sys 0m8.794s +> +> Which calculates out to about 161MB/s. +> +> - Luke +> +> +> On 7/21/05 2:55 PM, "Mark Wong" wrote: +> +> > I just ran through a few tests with the v14 patch against 100GB of data +> > from dbt3 and found a 30% improvement; 3.6 hours vs 5.3 hours. Just to +> > give a few details, I only loaded data and started a COPY in parallel +> > for each the data files: +> > http://www.testing.osdl.org/projects/dbt3testing/results/fast_copy/ +> > +> > Here's a visual of my disk layout, for those familiar with the database +> > schema: +> > http://www.testing.osdl.org/projects/dbt3testing/results/fast_copy/layout-dev4 +> > -010-dbt3.html +> > +> > I have 6 arrays of fourteen 15k rpm drives in a split-bus configuration +> > attached to a 4-way itanium2 via 6 compaq smartarray pci-x controllers. +> > +> > Let me know if you have any questions. +> > +> > Mark +> > +> + +From pgsql-performance-owner@postgresql.org Fri Jul 22 17:49:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2B44252924 + for ; + Fri, 22 Jul 2005 17:49:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99695-04 + for ; + Fri, 22 Jul 2005 20:49:00 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.204]) + by svr1.postgresql.org (Postfix) with ESMTP id E5E4C5291E + for ; + Fri, 22 Jul 2005 17:48:59 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 8so273449nzo + for ; + Fri, 22 Jul 2005 13:48:58 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=kma9qgwWfBz22gj+btHcjO2Au/c+gom5VXLMdJnlswp6HfIxDX6S2Ynpp4niOeHO+5Thx1YsIm6x9dG/+Zgt46QXmAKOEb68fcKYefT5tZMr4O5DbHThiImzhzIrL73DjSNf5CWZvPJ4YrUA/XkfAB8K0zzIPH36eFURsQbyQz8= +Received: by 10.36.5.19 with SMTP id 19mr34086nze; + Fri, 22 Jul 2005 13:48:58 -0700 (PDT) +Received: by 10.36.22.20 with HTTP; Fri, 22 Jul 2005 13:48:58 -0700 (PDT) +Message-ID: <758d5e7f05072213486919c8f4@mail.gmail.com> +Date: Fri, 22 Jul 2005 22:48:58 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: Tom Lane +Subject: Re: Planner doesn't look at LIMIT? +Cc: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org +In-Reply-To: <6440.1122049220@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: <758d5e7f0507220210bfa4978@mail.gmail.com> + <29473.1122043197@sss.pgh.pa.us> <6440.1122049220@sss.pgh.pa.us> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.611 tagged_above=0 required=5 tests=AWL, + FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/357 +X-Sequence-Number: 13598 + +On 7/22/05, Tom Lane wrote: +> > This is quite strange. The nestloop plan definitely should be preferre= +d +> > in the context of the LIMIT, considering that it has far lower estimate= +d +> > cost. And it is preferred in simple tests for me. +>=20 +> After a suitable period of contemplating my navel, I figured out +> what is going on here: the total costs involved are large enough that +> the still-fairly-high startup cost of the hash is disregarded by +> compare_fuzzy_path_costs(), and so the nestloop is discarded as not +> having any significant potential advantage in startup time. +>=20 +> I think that this refutes the original scheme of using the same fuzz +> factor for both startup and total cost comparisons, and therefore +> propose the attached patch. +>=20 +> Comments? + +Works great!!! + +With LIMIT below 4 000 000 rows (its 47-milion row table) it prefers +nested loops, then it starts to introduce merge joins. + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Sat Jul 23 21:39:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5B4625283C + for ; + Sat, 23 Jul 2005 01:09:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95774-02 + for ; + Sat, 23 Jul 2005 04:09:30 +0000 (GMT) +Received: from mail.Mi8.com (mail.mi8.com [63.240.6.41]) + by svr1.postgresql.org (Postfix) with ESMTP id AA4F45288F + for ; + Sat, 23 Jul 2005 01:09:28 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- GW01 Welcome + to Mi8 Corporation www.Mi8.com); Sat, 23 Jul 2005 00:09:12 -0400 +X-Server-Uuid: F1A2E19A-84E4-48DD-8F48-B475613F58B2 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Sat, 23 Jul + 2005 00:09:12 -0400 +Received: from 24.5.173.15 ([24.5.173.15]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Sat, 23 Jul + 2005 00:09:11 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Fri, 22 Jul 2005 21:09:10 -0700 +Subject: Re: [PATCHES] COPY FROM performance improvements +From: "Luke Lonergan" +To: "Mark Wong" +Cc: "Andrew Dunstan" , + "Alvaro Herrera" , + "Bruce Momjian" , + "Alon Goldshuv" , + pgsql-performance@postgresql.org, maryedie@osdl.org +Message-ID: +In-Reply-To: <200507221946.j6MJkljA024095@smtp.osdl.org> +MIME-Version: 1.0 +X-OriginalArrivalTime: 23 Jul 2005 04:09:12.0025 (UTC) + FILETIME=[4817B490:01C58F3C] +X-WSS-ID: 6EFF1D621J410642345-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, hits=1.599 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/363 +X-Sequence-Number: 13604 + +Mark, + +On 7/22/05 12:47 PM, "Mark Wong" wrote: + +> On a single spindle: +> +> $ time dd if=/dev/zero of=bigfile bs=8k count=2000000 +> 2000000+0 records in +> 2000000+0 records out +> +> real 2m8.569s +> user 0m0.725s +> sys 0m19.633s + +This is super fast! 124MB/s seems too fast for true write performance on a +single spindle. + +> But here are some number for my 12-disk lvm2 striped volume. + +So, software striping on how many controllers? + +> $ time dd if=/dev/zero of=bigfile3 bs=8k count=4000000 +> 4000000+0 records in +> 4000000+0 records out +> +> real 1m17.059s +> user 0m1.479s +> sys 0m41.293s + +Again - super fast at 416MB/s. How many controllers? + +When we had our problems with the cciss driver and the smartarray 5i/6 +controllers, we found the only way to get any performance out of them was to +run them in JBOD mode and software stripe. However, when we did so the CPU +usage skyrocketed and the performance of simple SCSI adapters was 50% faster +with less CPU consumption. These numbers show 100*(42.8/67) = 64% CPU +consumption, I'd expect less with 2 simple U320 SCSI controllers. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Sat Jul 23 07:42:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A38E652995; + Sat, 23 Jul 2005 07:42:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70068-03; Sat, 23 Jul 2005 10:42:36 +0000 (GMT) +Received: from colo.samason.me.uk (unknown [69.55.228.22]) + by svr1.postgresql.org (Postfix) with ESMTP id C2AEC52993; + Sat, 23 Jul 2005 07:42:35 -0300 (ADT) +Received: from colo.samason.me.uk (colo [69.55.228.22]) + by colo.samason.me.uk (8.12.11/8.12.11) with ESMTP id j6NAgZR8011880; + Sat, 23 Jul 2005 11:42:35 +0100 (BST) + (envelope-from sam@colo.samason.me.uk) +Received: (from sam@localhost) + by colo.samason.me.uk (8.12.11/8.12.11/Submit) id j6NAgZEt011877; + Sat, 23 Jul 2005 11:42:35 +0100 (BST) (envelope-from sam) +Date: Sat, 23 Jul 2005 11:42:35 +0100 +From: Sam Mason +To: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org +Subject: Re: [HACKERS] Planner doesn't look at LIMIT? +Message-ID: <20050723104235.GM62747@colo.samason.me.uk> +Mail-Followup-To: Sam Mason , + pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org +References: <758d5e7f0507220210bfa4978@mail.gmail.com> + <29473.1122043197@sss.pgh.pa.us> <6440.1122049220@sss.pgh.pa.us> + <1122053518.21502.180.camel@localhost.localdomain> + <7214.1122055577@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <7214.1122055577@sss.pgh.pa.us> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/358 +X-Sequence-Number: 13599 + +Tom Lane wrote: +>Could be. I went back to look at Sam Mason's report about three weeks +>ago, and it definitely seems to explain his issue. + +I've just built a patched version as well and it appears to be doing +what I think is the right thing now. I.e. actually picking the +plan with the lower cost. + +Thanks! + + + Sam + +From pgsql-performance-owner@postgresql.org Sat Jul 23 13:50:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1C16852A04 + for ; + Sat, 23 Jul 2005 13:50:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 41793-04 + for ; + Sat, 23 Jul 2005 16:50:37 +0000 (GMT) +Received: from calvin.surfutopia.net (calvin.surfutopia.net [67.120.245.34]) + by svr1.postgresql.org (Postfix) with ESMTP id ACEFC529E7 + for ; + Sat, 23 Jul 2005 13:50:35 -0300 (ADT) +Received: by calvin.surfutopia.net (Postfix, from userid 1000) + id A3960F21E; Sat, 23 Jul 2005 09:50:34 -0700 (PDT) +Date: Sat, 23 Jul 2005 09:50:34 -0700 +From: John Mendenhall +To: pgsql-performance list +Subject: re: performance decrease after reboot +Message-ID: <20050723165034.GA2700@calvin.surfutopia.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/359 +X-Sequence-Number: 13600 + +pgsql performance gurus, + +I sent the following message earlier this week. I have continued +attempting to find something on the net that would explain this +strange change of query plans, but nothing seems to apply. + +Are there any thoughts, such as possibly tweaking the database +somehow to see if I can get this to repeat consistently? + +Please let me know if any of you have any pointers as to +the cause of the different query plans. + +Thank you very much in advance for any pointers you can provide. + +JohnM + +On Tue, 19 Jul 2005, John Mendenhall wrote: + +> I tuned a query last week to obtain acceptable performance. +> Here is my recorded explain analyze results: +> +> LOG: duration: 826.505 ms statement: explain analyze +> [cut for brevity] +> +> I rebooted the database machine later that night. +> Now, when I run the same query, I get the following +> results: +> +> LOG: duration: 6931.701 ms statement: explain analyze +> [cut for brevity] + +I just ran my query again, no changes from yesterday +and it is back to normal: + +LOG: duration: 795.839 ms statement: explain analyze + +What could have been the problem? + +The major differences in the query plan are as follows: + +(1) The one that runs faster uses a Hash Join at the +very top of the query plan. It does a Hash Cond on +the country and code fields. + +(2) The one that runs slower uses a Materialize with +the subplan, with no Hash items. The Materialize does +Seq Scan of the countries table, and above it, a Join +Filter is run. + +(3) The partners_pkey index on the partners table is +in a different place in the query. + +Does anyone know what would cause the query plan to be +different like this, for the same server, same query? +I run vacuum analyze every night. Is this perhaps the +problem? + +What setting do I need to tweak to make sure the faster +plan is always found? + +Thanks for any pointers in this dilemma. + +JohnM + +-- +John Mendenhall +john@surfutopia.net +surf utopia +internet services + +From pgsql-performance-owner@postgresql.org Sat Jul 23 14:03:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A412E5290F + for ; + Sat, 23 Jul 2005 14:03:21 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44674-01 + for ; + Sat, 23 Jul 2005 17:03:12 +0000 (GMT) +Received: from mail.Mi8.com (mail.mi8.com [63.240.6.41]) + by svr1.postgresql.org (Postfix) with ESMTP id 2871B529E6 + for ; + Sat, 23 Jul 2005 14:03:11 -0300 (ADT) +Received: from 172.16.1.118 by mail.Mi8.com with ESMTP (- GW01 Welcome + to Mi8 Corporation www.Mi8.com); Sat, 23 Jul 2005 13:02:59 -0400 +X-Server-Uuid: F1A2E19A-84E4-48DD-8F48-B475613F58B2 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Sat, 23 Jul + 2005 13:02:59 -0400 +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: Re: re: performance decrease after reboot +Date: Sat, 23 Jul 2005 13:02:58 -0400 +Message-ID: <3E37B936B592014B978C4415F90D662D5B7198@MI8NYCMAIL06.Mi8.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] re: performance decrease after reboot +Thread-Index: AcWPpyrHZrTbCH0yQC2BgTaSghP+IwAATXkZ +From: "Luke Lonergan" +To: "John Mendenhall" , + "pgsql-performance list" +X-OriginalArrivalTime: 23 Jul 2005 17:02:59.0397 (UTC) + FILETIME=[60F67750:01C58FA8] +X-WSS-ID: 6EFCA7C91J411005260-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/360 +X-Sequence-Number: 13601 + +It's likely that data is in filesystem (not database) cache the second = +time you run the query. See if the same thing happens when you stop and = +restart the postmaster (it likely wont), then do something like this to = +flush the filesystem cache (read a big file, can't give you a sample cmd = +because my Treo has no equal sign :-) then run the query again. + +- Luke + + -----Original Message----- +From: John Mendenhall [mailto:john@surfutopia.net] +Sent: Sat Jul 23 12:54:18 2005 +To: pgsql-performance list +Subject: [PERFORM] re: performance decrease after reboot + +pgsql performance gurus, + +I sent the following message earlier this week. I have continued +attempting to find something on the net that would explain this +strange change of query plans, but nothing seems to apply. + +Are there any thoughts, such as possibly tweaking the database +somehow to see if I can get this to repeat consistently? + +Please let me know if any of you have any pointers as to=20 +the cause of the different query plans. + +Thank you very much in advance for any pointers you can provide. + +JohnM + +On Tue, 19 Jul 2005, John Mendenhall wrote: + +> I tuned a query last week to obtain acceptable performance. +> Here is my recorded explain analyze results: +> +> LOG: duration: 826.505 ms statement: explain analyze +> [cut for brevity] +>=20 +> I rebooted the database machine later that night. +> Now, when I run the same query, I get the following +> results: +>=20 +> LOG: duration: 6931.701 ms statement: explain analyze +> [cut for brevity] + +I just ran my query again, no changes from yesterday +and it is back to normal: + +LOG: duration: 795.839 ms statement: explain analyze + +What could have been the problem? + +The major differences in the query plan are as follows: + +(1) The one that runs faster uses a Hash Join at the +very top of the query plan. It does a Hash Cond on +the country and code fields. + +(2) The one that runs slower uses a Materialize with +the subplan, with no Hash items. The Materialize does +Seq Scan of the countries table, and above it, a Join +Filter is run. + +(3) The partners_pkey index on the partners table is +in a different place in the query. + +Does anyone know what would cause the query plan to be +different like this, for the same server, same query? +I run vacuum analyze every night. Is this perhaps the +problem? + +What setting do I need to tweak to make sure the faster +plan is always found? + +Thanks for any pointers in this dilemma. + +JohnM + +--=20 +John Mendenhall +john@surfutopia.net +surf utopia +internet services + +---------------------------(end of broadcast)--------------------------- +TIP 6: explain analyze is your friend + + + +From pgsql-performance-owner@postgresql.org Sat Jul 23 17:37:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6C78F5290F + for ; + Sat, 23 Jul 2005 17:37:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04247-02 + for ; + Sat, 23 Jul 2005 20:36:55 +0000 (GMT) +Received: from rambo.iniquinet.com (rambo.iniquinet.com [69.39.89.10]) + by svr1.postgresql.org (Postfix) with ESMTP id E865252B12 + for ; + Sat, 23 Jul 2005 17:36:53 -0300 (ADT) +Received: (qmail 9039 invoked by uid 1010); 23 Jul 2005 16:36:54 -0400 +Received: from Robert_Creager@LogicalChaos.org by rambo.iniquinet.com by uid + 1002 with qmail-scanner-1.20 (clamscan: 0.70. spamassassin: 3.0.3. + Clear:RC:0(63.147.78.131):SA:0(?/?):. + Processed in 1.281487 secs); 23 Jul 2005 20:36:54 -0000 +Received: from unknown (HELO thunder.logicalchaos.org) + (perl?test@logicalchaos.org@63.147.78.131) + by rambo.iniquinet.com with AES256-SHA encrypted SMTP; + 23 Jul 2005 16:36:53 -0400 +Received: from logicalchaos.org (thunder.logicalchaos.org [192.168.0.250]) + by thunder.logicalchaos.org (Postfix) with ESMTP id A6774611E8; + Sat, 23 Jul 2005 14:36:50 -0600 (MDT) +Date: Sat, 23 Jul 2005 14:36:50 -0600 +From: Robert Creager +Cc: Robert Creager , + Tom Lane , pgsql-performance@postgresql.org, + Andy Hewitt III +Subject: Re: Huge performance problem between 7.4.1 and 8.0.3 - CS +Message-ID: <20050723143650.5678061a@thunder.logicalchaos.org> +In-Reply-To: <20050719224908.15415222@thunder.logicalchaos.org> +References: <20050718114952.00004ac5@C118181.stortek.com> + <15472.1121709173@sss.pgh.pa.us> + <20050719105014.00007635@C118181.stortek.com> + <7322.1121792062@sss.pgh.pa.us> + <20050719120951.00002520@C118181.stortek.com> + <20050719224908.15415222@thunder.logicalchaos.org> +Organization: Starlight Vision, LLC. +X-Mailer: Sylpheed-Claws 1.0.3 (GTK+ 1.2.10; i586-mandrake-linux-gnu) +Mime-Version: 1.0 +Content-Type: multipart/signed; + boundary="Signature_Sat__23_Jul_2005_14_36_50_-0600_4Cp=mBFyqM7DO1VE"; + protocol="application/pgp-signature"; micalg=pgp-sha1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/361 +X-Sequence-Number: 13602 + +--Signature_Sat__23_Jul_2005_14_36_50_-0600_4Cp=mBFyqM7DO1VE +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: quoted-printable + + +I've now backed off to version 7.4.1, which doesn't exhibit the problems th= +at +8.0.3 does. I guess I'll wait 'till the next version and see if any progre= +ss +has occurred. + +Rob + +When grilled further on (Tue, 19 Jul 2005 22:49:08 -0600), +Robert Creager confessed: + +> When grilled further on (Tue, 19 Jul 2005 12:09:51 -0600), +> Robert Creager confessed: +>=20 +> > On Tue, 19 Jul 2005 12:54:22 -0400 +> > Tom Lane wrote: +> >=20 +> > > Hmm, I hadn't thought about the possible impact of multiple concurrent +> > > vacuums. Is the problem caused by that, or has performance already g= +one +> > > into the tank by the time the cron-driven vacuums are taking long eno= +ugh +> > > to overlap? +> >=20 +> >=20 +> > I'll re-start the database, vacuum full analyze and restart the runs wi= +thout +> the +> > cron vacuum running. +> >=20 +>=20 +> It took a few hours, but the problem did finally occur with no vacuum run= +ning +on +> 803. CS is averaging 72k. I cannot quantitatively say it took longer to +> reproduce than with the vacuums running, but it seemed like it did. +>=20 +> Can any information be gotten out of this? Should I try CVS HEAD? +>=20 +> Thoughts? +>=20 +> Thanks, +> Rob +>=20 +> --=20 +> 22:41:36 up 6 days, 2:16, 6 users, load average: 0.15, 0.21, 0.30 +> Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + + +--=20 + 14:35:32 up 9 days, 18:10, 5 users, load average: 2.17, 2.19, 2.15 +Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004 + +--Signature_Sat__23_Jul_2005_14_36_50_-0600_4Cp=mBFyqM7DO1VE +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (GNU/Linux) + +iEYEARECAAYFAkLiqmIACgkQLQ/DKuwDYzksAQCdGNv/wST8EwGMlSgbUY0jWmrB +GVgAoI/OWLXYULkLGMvKLzlB1+CeKSNB +=Y7SY +-----END PGP SIGNATURE----- + +--Signature_Sat__23_Jul_2005_14_36_50_-0600_4Cp=mBFyqM7DO1VE-- + +From pgsql-performance-owner@postgresql.org Mon Jul 25 05:26:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DE79852BF0 + for ; + Mon, 25 Jul 2005 05:26:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20207-01 + for ; + Mon, 25 Jul 2005 08:26:45 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 22134529B1 + for ; + Mon, 25 Jul 2005 05:26:43 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id DBED0644170 + for ; + Mon, 25 Jul 2005 02:26:16 -0600 (MDT) +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 12292-01 for ; + Mon, 25 Jul 2005 02:26:14 -0600 (MDT) +Received: from [192.168.1.12] (c-24-9-24-35.hsd1.co.comcast.net [24.9.24.35]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id C7A71644168 + for ; + Mon, 25 Jul 2005 02:26:14 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +Content-Transfer-Encoding: 7bit +Message-Id: <1F0E51A1-C682-4CE1-95F5-BE50032D7122@drivefaster.net> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +To: pgsql-performance@postgresql.org +From: Dan Harris +Subject: Coraid/AoE device experience? +Date: Mon, 25 Jul 2005 02:27:31 -0600 +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/366 +X-Sequence-Number: 13607 + +Lately, I've been reading a lot about these new Coraid AoE RAID +devices ( http://www.coraid.com ). They tout it as being fast and +cheap and better than iSCSI due to the lack of TCP/IP over the wire. +Is it likely that a 15-drive RAID 10 Linux software RAID would +outperform a 4-drive 10k SCSI RAID 0+1 for a heavy-loaded database? +If not software RAID, how about their dedicated RAID controller blade? + +I'm definitely IO bound right now and starving for spindles. Does +this make sense or is it too good to be true? + +Thanks +-Dan + +From pgsql-performance-owner@postgresql.org Mon Jul 25 10:16:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5887852C4C + for ; + Mon, 25 Jul 2005 10:15:41 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71774-03 + for ; + Mon, 25 Jul 2005 13:15:39 +0000 (GMT) +Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) + by svr1.postgresql.org (Postfix) with ESMTP id C38D352C45 + for ; + Mon, 25 Jul 2005 10:15:37 -0300 (ADT) +Received: from mainbox.archonet.com + (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) + by smtp.metronet.co.uk (MetroNet Mail) with ESMTP + id C4BFE40DC7A; Mon, 25 Jul 2005 14:15:30 +0100 (BST) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mainbox.archonet.com (Postfix) with ESMTP id 580C715EDA; + Mon, 25 Jul 2005 14:04:04 +0100 (BST) +Received: from mainbox.archonet.com ([127.0.0.1]) + by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 06609-05; Mon, 25 Jul 2005 14:04:01 +0100 (BST) +Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP id 744E015ED9; + Mon, 25 Jul 2005 14:04:01 +0100 (BST) +Message-ID: <42E4E341.4050807@archonet.com> +Date: Mon, 25 Jul 2005 14:04:01 +0100 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Shashi Kanth Boddula +Cc: pgsql-performance@postgresql.org +Subject: Re: Mirroring PostgreSQL database +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/368 +X-Sequence-Number: 13609 + +Shashi Kanth Boddula wrote: +> +> The customer is using DBmirror tool to mirror the database records of +> primary to secondary . The customer is complaining that there is one day +> (24 hours) delay between primary and secondray for database +> synchronization . They have dedicated line and bandwidth , but still the +> problems exists. + +You don't say what the nature of the problem with dbmirror is. Are they +saturating their bandwidth? Are one or both servers unable to keep pace +with the updates? + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Mon Jul 25 12:20:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E87E952AD2 + for ; + Mon, 25 Jul 2005 12:20:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07901-05 + for ; + Mon, 25 Jul 2005 15:20:33 +0000 (GMT) +Received: from vscan02.westnet.com.au (vscan02.westnet.com.au [203.10.1.132]) + by svr1.postgresql.org (Postfix) with ESMTP id B175152AA0 + for ; + Mon, 25 Jul 2005 12:20:31 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by localhost (Postfix) with ESMTP id 115E111F2B2; + Mon, 25 Jul 2005 23:20:30 +0800 (WST) +Received: from vscan02.westnet.com.au ([127.0.0.1]) + by localhost (vscan02.westnet.com.au [127.0.0.1]) (amavisd-new, + port 10024) + with ESMTP id 01494-02; Mon, 25 Jul 2005 23:20:30 +0800 (WST) +Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au + [202.72.133.22]) + by vscan02.westnet.com.au (Postfix) with ESMTP id 8B4AD11F58A; + Mon, 25 Jul 2005 23:20:29 +0800 (WST) +Message-ID: <42E5033F.7090201@familyhealth.com.au> +Date: Mon, 25 Jul 2005 23:20:31 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Shashi Kanth Boddula +Cc: pgsql-performance@postgresql.org +Subject: Re: Mirroring PostgreSQL database +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.247 tagged_above=0 required=5 tests=AWL, INFO_TLD +X-Spam-Level: +X-Archive-Number: 200507/369 +X-Sequence-Number: 13610 + +Try Slony: www.slony.info + +Shashi Kanth Boddula wrote: +> +> Hi, +> I have one customer who is using PostgreSQL 7.4.8 on Linux . He has some +> problems with database mirroring . The details are follows. +> The customer is using Linux on which PostgreSQL 7.4.8 along with Jboss +> 3.2.3 is running . He has 2 servers , one is acting as a live server +> (primary) and another is acting as a fail-over (secondary) server +> . Secondary server is placed in remote location . These servers are +> acting as a Attendence server for daily activities . Nearly 50,000 +> employees depend on the live server . +> +> The customer is using DBmirror tool to mirror the database records of +> primary to secondary . The customer is complaining that there is one day +> (24 hours) delay between primary and secondray for database +> synchronization . They have dedicated line and bandwidth , but still the +> problems exists. +> +> I just want to know , for immediate data mirroring , what is the best +> way for PostgreSQL . PostgreSQL is offering many mirror tools , but +> which one is the best ?. Is there any other way to accomplish the task ? +> +> Thank you . Waiting for your reply. +> +> +> Thanks & Regards, +> Shashi Kanth +> Consultant - Linux +> RHCE , LPIC-2 +> Onward Novell - Bangalore +> 9886455567 +> +> + +From pgsql-performance-owner@postgresql.org Mon Jul 25 13:03:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7D83C52ABC + for ; + Mon, 25 Jul 2005 13:03:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14248-09 + for ; + Mon, 25 Jul 2005 16:03:41 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id D16B452BA3 + for ; + Mon, 25 Jul 2005 13:03:38 -0300 (ADT) +Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + j6PG3Hhr025113; Mon, 25 Jul 2005 09:03:17 -0700 +Message-ID: <42E50D59.8020500@commandprompt.com> +Date: Mon, 25 Jul 2005 09:03:37 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.6-1.1.fc3 (X11/20050720) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Shashi Kanth Boddula +Cc: pgsql-performance@postgresql.org +Subject: Re: Mirroring PostgreSQL database +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.254 tagged_above=0 required=5 tests=AWL, INFO_TLD +X-Spam-Level: +X-Archive-Number: 200507/370 +X-Sequence-Number: 13611 + + +> I just want to know , for immediate data mirroring , what is the best +> way for PostgreSQL . PostgreSQL is offering many mirror tools , but +> which one is the best ?. Is there any other way to accomplish the task ? + +You want to take a look at Slony-I or Mammoth Replicator. + +http://www.slony.info/ +http://www.commandprompt.com/ + + +> +> Thank you . Waiting for your reply. +> +> +> Thanks & Regards, +> Shashi Kanth +> Consultant - Linux +> RHCE , LPIC-2 +> Onward Novell - Bangalore +> 9886455567 +> +> + + +-- +Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 +PostgreSQL Replication, Consulting, Custom Programming, 24x7 support +Managed Services, Shared and Dedicated Hosting +Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ + +From pgsql-performance-owner@postgresql.org Mon Jul 25 09:37:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2D10F52B68 + for ; + Mon, 25 Jul 2005 09:37:08 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63237-03 + for ; + Mon, 25 Jul 2005 12:36:59 +0000 (GMT) +Received: from lucius.provo.novell.com (lucius.provo.novell.com + [137.65.81.172]) + by svr1.postgresql.org (Postfix) with ESMTP id 9F9E552AEE + for ; + Mon, 25 Jul 2005 09:36:57 -0300 (ADT) +Received: from INET-PRV1-MTA by lucius.provo.novell.com + with Novell_GroupWise; Mon, 25 Jul 2005 06:37:00 -0600 +Message-Id: +X-Mailer: Novell GroupWise Internet Agent 6.5.4 Beta +Date: Mon, 25 Jul 2005 12:01:52 -0600 +From: "Shashi Kanth Boddula" +To: +Subject: Mirroring PostgreSQL database +Mime-Version: 1.0 +Content-Type: multipart/alternative; boundary="=__PartE6C54C00.0__=" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.622 tagged_above=0 required=5 tests=AWL, + DATE_IN_FUTURE_03_06, DNS_FROM_RFC_ABUSE, HTML_40_50, HTML_FONT_BIG, + HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200507/367 +X-Sequence-Number: 13608 + +This is a MIME message. If you are reading this text, you may want to +consider changing to a mail reader or gateway that understands how to +properly handle MIME multipart messages. + +--=__PartE6C54C00.0__= +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit + +Hi, +I have one customer who is using PostgreSQL 7.4.8 on Linux . He has some +problems with database mirroring . The details are follows. +The customer is using Linux on which PostgreSQL 7.4.8 along with Jboss +3.2.3 is running . He has 2 servers , one is acting as a live server +(primary) and another is acting as a fail-over (secondary) server . +Secondary server is placed in remote location . These servers are acting +as a Attendence server for daily activities . Nearly 50,000 employees +depend on the live server . + +The customer is using DBmirror tool to mirror the database records of +primary to secondary . The customer is complaining that there is one day +(24 hours) delay between primary and secondray for database +synchronization . They have dedicated line and bandwidth , but still the +problems exists. + +I just want to know , for immediate data mirroring , what is the best +way for PostgreSQL . PostgreSQL is offering many mirror tools , but +which one is the best ?. Is there any other way to accomplish the task ? + + +Thank you . Waiting for your reply. + + +Thanks & Regards, +Shashi Kanth +Consultant - Linux +RHCE , LPIC-2 +Onward Novell - Bangalore +9886455567 + + + + +--=__PartE6C54C00.0__= +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable + + + + + =20 + + +
+ Hi, +
+
+ +
+
+ I have one customer who is using = +PostgreSQL 7.4.8 on Linux . He has some problems with database mirroring . = +The details are follows. +
+
+ +
+
+
The customer is using Linux on which PostgreSQL 7.4.8 along = +with Jboss 3.2.3 is running . He has 2 servers , one is acting as a live = +server (primary) and another is acting as a fail-over (secondary) = +0;server .  Secondary server is placed in remote location . = +These servers are acting as a Attendence server for daily activities . = +Nearly 50,000 employees depend on the live server . +
+
+
  +
+
+
The customer is using DBmirror tool to mirror the database = +records of primary to secondary . The customer is complaining that there = +is one day (24 hours) delay between primary and secondray for database = +synchronization . They have dedicated line and bandwidth , but still the = +problems exists. +
+
+
  +
+
+
I just want to know , for immediate data mirroring , what = +is the best way for PostgreSQL . PostgreSQL is offering many mirror tools = +, but which one is the best ?. Is there any other way to accomplish the = +task ? +
+
+
  +
+
+
Thank you . Waiting for your reply. +
+
+
  +
+
Thanks & Regards,
Shashi Kanth
Consultant - Linux
RHCE , = +LPIC-2
Onward Novell - Bangalore
9886455567


+ + +--=__PartE6C54C00.0__=-- + +From pgsql-performance-owner@postgresql.org Mon Jul 25 18:31:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9DD0C52CB9 + for ; + Mon, 25 Jul 2005 18:30:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97657-10 + for ; + Mon, 25 Jul 2005 21:30:41 +0000 (GMT) +Received: from wsmailap01.firstam.com (outbound-smtp01.firstam.com + [208.246.101.197]) + by svr1.postgresql.org (Postfix) with ESMTP id 0CF0052C4E + for ; + Mon, 25 Jul 2005 18:30:40 -0300 (ADT) +Received: from 172.21.131.6 by wsmailap01.firstam.com with ESMTP ( + Tumbleweed MMS SMTP Relay (MMS v5.6.3)); Mon, 25 Jul 2005 14:30:15 + -0700 +X-Server-Uuid: 2A3A6F04-3324-429D-9DE4-35238E3EA19C +Received: from anammx01.ana.firstamdata.com ([192.168.173.35]) by + famarp02.firstam.com (MOS 3.5.6-GR) with SMTP id JHG71200; Mon, 25 Jul + 2005 14:30:25 -0700 (PDT) +Received: from pisgana01sxch21.ana.firstamdata.com (Not + Verified[192.168.173.71]) by mailgateway.firstam.com (post.office MTA + v5.0 0924 ) with ESMTP id ; Mon, 25 Jul 2005 14:30:24 -0700 +Received: from pisgana01sxch01.ana.firstamdata.com ([192.168.173.70]) by + pisgana01sxch21.ana.firstamdata.com with Microsoft SMTPSVC(6.0.3790.211 + ); Mon, 25 Jul 2005 14:30:24 -0700 +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: "Vacuum Full Analyze" taking so long +Date: Mon, 25 Jul 2005 14:30:24 -0700 +Message-ID: + +Thread-Topic: "Vacuum Full Analyze" taking so long +Thread-Index: AcWRM43r8tyNyV7ORnakp9LzUlpbiwAKySfA +From: "Tomeh, Husam" +To: pgsql-performance@postgresql.org +X-OriginalArrivalTime: 25 Jul 2005 21:30:24.0503 (UTC) + FILETIME=[116AD870:01C59160] +X-WSS-ID: 6EFB866D0ZK914752-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.029 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/371 +X-Sequence-Number: 13612 + +=20 +I have an 8.02 postgresql database with about 180 GB in size, running on +2.6 RedHat kernel with 32 GB of RAM and 2 CPUs. I'm running the vacuum +full analyze command, and has been running for at least two consecutive +days with no other processes running (it's an offline loading server). I +tweaked the maintenanace_mem to its max (2 GB) with work_mem of 8M. I +have no issues with my checkpoints. I can still I/O activities against +the physical files of the "property" table and its two indexes (primary +key and r index). The property files are about 128GB and indexes are +about 15 GB. I have run the same maintenance job on a different box +(staging) with identical hardware config (except with 64 GB instead of +32) and took less than 12 hours. Any clue or tip is really +appreciated.=20 + +Also read a comment by Tom Lane, that terminating the process should be +crash-safe if I had to.=20 + +Thanks, + + +--=20 +=20Husam=20 + +---------------------------(end of broadcast)--------------------------- +TIP 5: don't forget to increase your free space map settings + +********************************************************************** +This message contains confidential information intended only for the=20 +use of the addressee(s) named above and may contain information that=20 +is legally privileged. If you are not the addressee, or the person=20 +responsible for delivering it to the addressee, you are hereby=20 +notified that reading, disseminating, distributing or copying this=20 +message is strictly prohibited. If you have received this message by=20 +mistake, please immediately notify us by replying to the message and=20 +delete the original message immediately thereafter. + +Thank you. FADLD Tag +********************************************************************** + + +From pgsql-performance-owner@postgresql.org Mon Jul 25 20:37:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9958D52EC6 + for ; + Mon, 25 Jul 2005 19:19:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10905-10 + for ; + Mon, 25 Jul 2005 22:19:20 +0000 (GMT) +Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) + by svr1.postgresql.org (Postfix) with ESMTP id DDD9A52EB2 + for ; + Mon, 25 Jul 2005 19:19:16 -0300 (ADT) +Received: from osgiliath.mathom.us ([70.108.53.154]) + by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IK700KPAFC6CIB3@vms040.mailsrvcs.net> for + pgsql-performance@postgresql.org; Mon, 25 Jul 2005 17:19:18 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id 8312864C998; Mon, + 25 Jul 2005 17:30:58 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 17223-06; Mon, 25 Jul 2005 17:30:58 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id 605C960E567; Mon, 25 Jul 2005 17:30:58 -0400 (EDT) +Date: Mon, 25 Jul 2005 17:30:58 -0400 +From: Michael Stone +Subject: Re: "Vacuum Full Analyze" taking so long +In-reply-to: + +To: "Tomeh, Husam" +Cc: pgsql-performance@postgresql.org +Mail-Followup-To: "Tomeh, Husam" , + pgsql-performance@postgresql.org +Message-id: <20050725213058.GQ19080@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us +References: + +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/375 +X-Sequence-Number: 13616 + +I'd say, "don't do that". Unless you've deleted a lot of stuff and are +expecting the DB to shrink, a full vacuum shouldn't really be needed. On +a DB that big a full vacuum is just going to take a long time. If you +really are shrinking, consider structuring things so you can just drop a +table instead of vacuuming it (the drop is fairly instantaneous). If you +can't do that, consider dropping the indices, vacuuming, and recreating +the indices. + +Mike Stone + +From pgsql-performance-owner@postgresql.org Mon Jul 25 19:39:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AD47E52B0F + for ; + Mon, 25 Jul 2005 19:32:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12486-10 + for ; + Mon, 25 Jul 2005 22:32:49 +0000 (GMT) +Received: from tbmail.tradebot.com + (Tradebot-Systems-1096753.cust-rtr.swbell.net [68.90.170.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 09D4452A2F + for ; + Mon, 25 Jul 2005 19:32:48 -0300 (ADT) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C59168.CA5AE400" +Subject: COPY insert performance +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Date: Mon, 25 Jul 2005 17:32:50 -0500 +Message-ID: <07774C6E31D94A44A2A60E2085944F09071DF0@tbmail.tradebot.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: COPY insert performance +Thread-Index: AcWRaMpXtxbNujNETa+mMZ0MXi+QSg== +From: "Chris Isaacson" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.837 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, HTML_50_60, HTML_MESSAGE, HTML_TEXT_AFTER_BODY, + HTML_TEXT_AFTER_HTML +X-Spam-Level: * +X-Archive-Number: 200507/372 +X-Sequence-Number: 13613 + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C59168.CA5AE400 +Content-Type: text/plain; + charset="US-ASCII" +Content-Transfer-Encoding: quoted-printable + +I need COPY via libpqxx to insert millions of rows into two tables. One +table has roughly have as many rows and requires half the storage. In +production, the largest table will grow by ~30M rows/day. To test the +COPY performance I split my transactions into 10,000 rows. I insert +roughly 5000 rows into table A for every 10,000 rows into table B. +=20 +Table A has one unique index: +=20 +"order_main_pk" UNIQUE, btree (cl_ord_id) +=20 +Table B has 1 unique index and 2 non-unique indexes: +=20 +"order_transition_pk" UNIQUE, btree (collating_seq) +"order_transition_ak2" btree (orig_cl_ord_id) +"order_transition_ak3" btree (exec_id) +=20 +My testing environment is as follows: +-Postgresql 8.0.1 +-libpqxx 2.5.0 +-Linux 2.6.11.4-21.7-smp x86_64=20 +-Dual Opteron 246 +-System disk (postgres data resides on this SCSI disk) - Seagate +(ST373453LC) - 15K, 73 GB +(http://www.seagate.com/cda/products/discsales/marketing/detail/0,1081,5 +49,00.html) +-2nd logical disk - 10K, 36GB IBM SCSI (IC35L036UCDY10-0) - WAL reside +on this disk +-NO RAID +=20 +PostgreSQL +Here are the results of copying in 10M rows as fast as possible: +(10K/transaction) +Total Time: 1129.556 s +Rows/sec: 9899.922 +Transaction>1.2s 225 +Transaction>1.5s 77 +Transaction>2.0s 4 +Max Transaction 2.325s +=20 +MySQL +I ran a similar test with MySQL 4.1.10a (InnoDB) which produced these +results: (I used MySQL's INSERT INTO x VALUES +(1,2,3)(4,5,6)(...,...,...) syntax) (10K/transaction) +Total Time: 860.000 s +Rows/sec: 11627.91 +Transaction>1.2s 0 +Transaction>1.5s 0 +Transaction>2.0s 0 +Max Transaction 1.175s +=20 +Considering the configurations shown below, can anyone offer advice to +close the 15% gap and the much worse variability I'm experiencing. +Thanks +=20 +My postgresql.conf has the following non-default values: +# ----------------------------- +# PostgreSQL configuration file +# ----------------------------- +listen_addresses =3D '*' # what IP interface(s) to listen on;=20 +max_connections =3D 100 +#----------------------------------------------------------------------- +---- +# RESOURCE USAGE (except WAL) +#----------------------------------------------------------------------- +---- +shared_buffers =3D 65536 # min 16, at least max_connections*2, 8KB each +work_mem =3D 2048 # min 64, size in KB +maintenance_work_mem =3D 204800 # min 1024, size in KB +max_fsm_pages =3D 2250000 # min max_fsm_relations*16, 6 bytes each +bgwriter_delay =3D 200 # 10-10000 milliseconds between rounds +bgwriter_percent =3D 10 # 0-100% of dirty buffers in each round +bgwriter_maxpages =3D 1000 # 0-1000 buffers max per round +#----------------------------------------------------------------------- +---- +# WRITE AHEAD LOG +#----------------------------------------------------------------------- +---- +fsync =3D false # turns forced synchronization on or off +wal_buffers =3D 64 # min 4, 8KB each +checkpoint_segments =3D 40 # in logfile segments, min 1, 16MB each +checkpoint_timeout =3D 600 # range 30-3600, in seconds +#----------------------------------------------------------------------- +---- +# QUERY TUNING +#----------------------------------------------------------------------- +---- +effective_cache_size =3D 65536 # typically 8KB each +random_page_cost =3D 2 # units are one sequential page fetch cost +#----------------------------------------------------------------------- +---- +# ERROR REPORTING AND LOGGING +#----------------------------------------------------------------------- +---- =20 +log_min_duration_statement =3D 250 # -1 is disabled, in milliseconds. +log_connections =3D true +log_disconnections =3D true +log_duration =3D true +log_line_prefix =3D '<%r%u%p%t%d%%' # e.g. '<%u%%%d> '=20 + # %u=3Duser name %d=3Ddatabase name + # %r=3Dremote host and port + # %p=3DPID %t=3Dtimestamp %i=3Dcommand tag + # %c=3Dsession id %l=3Dsession line number + # %s=3Dsession start timestamp %x=3Dtransaction id + # %q=3Dstop here in non-session processes + # %%=3D'%' +log_statement =3D 'none' # none, mod, ddl, all +#----------------------------------------------------------------------- +---- +# RUNTIME STATISTICS +#----------------------------------------------------------------------- +---- +# - Query/Index Statistics Collector - +stats_start_collector =3D true +stats_command_string =3D true +stats_block_level =3D true +stats_row_level =3D true +stats_reset_on_server_start =3D true +=20 +My MySQL my.ini has the following non default values: +innodb_data_home_dir =3D /var/lib/mysql/ +innodb_data_file_path =3D ibdata1:10M:autoextend +innodb_log_group_home_dir =3D /var/lib/mysql/ +innodb_log_arch_dir =3D /var/lib/mysql/ +# You can set .._buffer_pool_size up to 50 - 80 % +# of RAM but beware of setting memory usage too high +innodb_buffer_pool_size =3D 512M +innodb_additional_mem_pool_size =3D 64M +# Set .._log_file_size to 25 % of buffer pool size +innodb_log_file_size =3D 128M +innodb_log_buffer_size =3D 64M +innodb_flush_log_at_trx_commit =3D 1 +innodb_lock_wait_timeout =3D 50 +innodb_flush_method =3D O_DSYNC +max_allowed_packet =3D 16M + +=20 +=20 +=20 + +------_=_NextPart_001_01C59168.CA5AE400 +Content-Type: text/html; + charset="US-ASCII" +Content-Transfer-Encoding: quoted-printable + + +Message + + + +
I = +need COPY via=20 +libpqxx to insert millions of rows into two tables.  One table has = +roughly=20 +have as many rows and requires half the storage.  In production, = +the=20 +largest table will grow by ~30M rows/day.  To test the COPY = +performance I=20 +split my transactions into 10,000 rows.  I insert roughly 5000 = +rows=20 +into table A for every 10,000 rows into table = +B.
+
 
+
Table = +A has one=20 +unique index:
+
 
+
"order_main_pk"=20 +UNIQUE, btree (cl_ord_id)
+
 
+
Table = +B has 1 unique=20 +index and 2 non-unique indexes:
+
 
+
"order_transition_pk" UNIQUE, btree=20 +(collating_seq)
"order_transition_ak2" btree=20 +(orig_cl_ord_id)
"order_transition_ak3" btree = +(exec_id)
+
 
+
My = +testing=20 +environment is as follows:
+
-Postgresql=20 +8.0.1
+
-libpqxx=20 +2.5.0
+
-Linux = +2.6.11.4-21.7-smp x86_64=20 +
+
-Dual = +Opteron=20 +246
+
-System disk=20 +(postgres data resides on this SCSI disk) -  Seagate (ST373453LC) - 15K, 73 GB (http://www.seagate.com/cda/products/discsales/marketing= +/detail/0,1081,549,00.html)
+
-2nd logical disk - 10K, = +36GB IBM SCSI=20 +(IC35L036UCDY10-0) - WAL reside on this disk
+
-NO RAID
+
 
+
PostgreSQL +
Here = +are the results=20 +of copying in 10M rows as fast as possible:=20 +(10K/transaction)
+
Total=20 +Time:            = +1129.556=20 +s
+
Rows/sec:      &= +nbsp;     =20 +9899.922
+
Transaction>1.2s   =20 +225
+
+
Transaction>1.5s    =20 +77
+
+
Transaction>2.0s    &nb= +sp;=20 +4
+
Max=20 +Transaction       2.325s= +
+
 
+
MySQL<= +/FONT>
+
I ran a similar = +test with MySQL=20 +4.1.10a (InnoDB) which produced these results: (I used MySQL's = +INSERT=20 +INTO x VALUES (1,2,3)(4,5,6)(...,...,...) syntax)=20 +(10K/transaction)
+
Total=20 +Time:         860.000=20 +s
+
Rows/sec:      &= +nbsp; 11627.91
+
+
Transaction>1.2s    &nb= +sp;=20 +0
+
+
Transaction>1.5s    &nb= +sp;=20 +0
+
+
Transaction>2.0s    &nb= +sp;=20 +0
+
Max=20 +Transaction       1.175s= +
+
 
+
Considering the=20 +configurations shown below, can anyone offer advice to close the 15% gap = +and the=20 +much worse variability I'm experiencing. =20 +Thanks
+
 
+
My=20 +postgresql.conf has the following non-default=20 +values:
+
#=20 +-----------------------------
# PostgreSQL configuration file
#=20 +-----------------------------
listen_addresses =3D '*' # what IP = + +interface(s) to listen on;
max_connections =3D = +100
+
#---------------------------------------------= +------------------------------
#=20 +RESOURCE USAGE (except=20 +WAL)
#----------------------------------------------------------------= +-----------
shared_buffers=20 +=3D 65536  # min 16, at least max_connections*2, 8KB = +each
work_mem =3D=20 +2048   # min 64, size in KB
maintenance_work_mem =3D=20 +204800 # min 1024, size in KB
max_fsm_pages =3D = +2250000  # min=20 +max_fsm_relations*16, 6 bytes each
bgwriter_delay =3D = +200  # 10-10000=20 +milliseconds between rounds
bgwriter_percent =3D 10  # = +0-100% of=20 +dirty buffers in each round
bgwriter_maxpages =3D 1000 # 0-1000 = +buffers=20 +max per round
+
#---------------------------------------------= +------------------------------
#=20 +WRITE AHEAD=20 +LOG
#-----------------------------------------------------------------= +----------
fsync=20 +=3D false   # turns forced synchronization on or = +off
wal_buffers=20 +=3D 64  # min 4, 8KB each
checkpoint_segments =3D 40 # in logfile = +segments,=20 +min 1, 16MB each
checkpoint_timeout =3D 600 # range 30-3600, in=20 +seconds
+
#---------------------------------------------= +------------------------------
#=20 +QUERY=20 +TUNING
#--------------------------------------------------------------= +-------------
effective_cache_size=20 +=3D 65536 # typically 8KB each
random_page_cost =3D = +2  # units are=20 +one sequential page fetch cost
+
#---------------------------------------------= +------------------------------
#=20 +ERROR REPORTING AND=20 +LOGGING
#-------------------------------------------------------------= +--------------  =20 +
log_min_duration_statement =3D    250 # -1 is = +disabled, in=20 +milliseconds.
+
log_connections =3D=20 +true
log_disconnections =3D true
log_duration =3D = +true
log_line_prefix =3D=20 +'<%r%u%p%t%d%%'  # e.g. '<%u%%%d> '=20 +
    # %u=3Duser name %d=3Ddatabase=20 +name
    # %r=3Dremote host and=20 +port
    # %p=3DPID %t=3Dtimestamp %i=3Dcommand=20 +tag
    # %c=3Dsession id %l=3Dsession line=20 +number
    # %s=3Dsession start timestamp = +%x=3Dtransaction=20 +id
    # %q=3Dstop here in non-session=20 +processes
    # %%=3D'%'
log_statement =3D=20 +'none'  # none, mod, ddl, all
+
#---------------------------------------------= +------------------------------
#=20 +RUNTIME=20 +STATISTICS
#----------------------------------------------------------= +-----------------
#=20 +- Query/Index Statistics Collector -
stats_start_collector =3D=20 +true
stats_command_string =3D true
stats_block_level =3D=20 +true
stats_row_level =3D true
stats_reset_on_server_start =3D=20 +true
+
 
+
My = +MySQL=20 +my.ini has the following non default=20 +values:
+
innodb_data_home_dir =3D=20 +/var/lib/mysql/
innodb_data_file_path =3D=20 +ibdata1:10M:autoextend
innodb_log_group_home_dir =3D=20 +/var/lib/mysql/
innodb_log_arch_dir =3D /var/lib/mysql/
# You can = +set=20 +.._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting = +memory=20 +usage too high
innodb_buffer_pool_size =3D=20 +512M
innodb_additional_mem_pool_size =3D 64M
# Set = +.._log_file_size to 25 %=20 +of buffer pool size
innodb_log_file_size =3D = +128M
innodb_log_buffer_size =3D=20 +64M
innodb_flush_log_at_trx_commit =3D 1
innodb_lock_wait_timeout = +=3D=20 +50
innodb_flush_method =3D O_DSYNC
+
max_allowed_packet =3D = +16M
+
 
+
 
+
 
+=00 +------_=_NextPart_001_01C59168.CA5AE400-- + +From pgsql-performance-owner@postgresql.org Mon Jul 25 21:10:05 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6EE1E52C52 + for ; + Mon, 25 Jul 2005 19:49:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17584-01 + for ; + Mon, 25 Jul 2005 22:48:49 +0000 (GMT) +Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) + by svr1.postgresql.org (Postfix) with ESMTP id DA85652C4F + for ; + Mon, 25 Jul 2005 19:48:47 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D1)); Mon, 25 Jul 2005 18:48:42 -0400 +X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 25 Jul + 2005 18:48:42 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Mon, 25 Jul + 2005 18:48:41 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Mon, 25 Jul 2005 15:48:39 -0700 +Subject: Re: "Vacuum Full Analyze" taking so long +From: "Luke Lonergan" +To: "Tomeh, Husam" , + pgsql-performance@postgresql.org +Message-ID: +In-Reply-To: + +MIME-Version: 1.0 +X-OriginalArrivalTime: 25 Jul 2005 22:48:42.0462 (UTC) + FILETIME=[019E7FE0:01C5916B] +X-WSS-ID: 6EFBB3C02B46200164-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, hits=1.574 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/376 +X-Sequence-Number: 13617 + +Vacuum full takes an exclusive lock on the tables it runs against, so if you +have anything else reading the table while you are trying to run it, the +vacuum full will wait, possibly forever until it can get the lock. + +What does the system load look like while you are running this? What does +vmstat 1 show you? Is there load on the system other than the database? + +Do you really need to run vacuum full instead of vacuum? + +- Luke + + +On 7/25/05 2:30 PM, "Tomeh, Husam" wrote: + +> +> I have an 8.02 postgresql database with about 180 GB in size, running on +> 2.6 RedHat kernel with 32 GB of RAM and 2 CPUs. I'm running the vacuum +> full analyze command, and has been running for at least two consecutive +> days with no other processes running (it's an offline loading server). I +> tweaked the maintenanace_mem to its max (2 GB) with work_mem of 8M. I +> have no issues with my checkpoints. I can still I/O activities against +> the physical files of the "property" table and its two indexes (primary +> key and r index). The property files are about 128GB and indexes are +> about 15 GB. I have run the same maintenance job on a different box +> (staging) with identical hardware config (except with 64 GB instead of +> 32) and took less than 12 hours. Any clue or tip is really +> appreciated. +> +> Also read a comment by Tom Lane, that terminating the process should be +> crash-safe if I had to. +> +> Thanks, +> + + + +From pgsql-performance-owner@postgresql.org Mon Jul 25 20:32:19 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8EE1252AC4 + for ; + Mon, 25 Jul 2005 20:08:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18171-10 + for ; + Mon, 25 Jul 2005 23:08:44 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id EC51452894 + for ; + Mon, 25 Jul 2005 20:08:43 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050725230844m9200g3m59e>; Mon, 25 Jul 2005 23:08:44 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 4797A5600C; Mon, 25 Jul 2005 18:08:44 -0500 (CDT) +Received: from [192.168.1.112] (71-32-73-140.cdrr.qwest.net [71.32.73.140]) + by juju.arbash-meinel.com (Postfix) with ESMTP id F166C55FB5; + Mon, 25 Jul 2005 18:08:34 -0500 (CDT) +Message-ID: <42E570F1.7090500@arbash-meinel.com> +Date: Mon, 25 Jul 2005 18:08:33 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Chris Isaacson , + Postgresql Performance +Subject: Re: COPY insert performance +References: <07774C6E31D94A44A2A60E2085944F09071DF0@tbmail.tradebot.com> +In-Reply-To: <07774C6E31D94A44A2A60E2085944F09071DF0@tbmail.tradebot.com> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig409DCEA0AEEAA541DD15189C" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/374 +X-Sequence-Number: 13615 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig409DCEA0AEEAA541DD15189C +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Chris Isaacson wrote: +> I need COPY via libpqxx to insert millions of rows into two tables. One +> table has roughly have as many rows and requires half the storage. In +> production, the largest table will grow by ~30M rows/day. To test the +> COPY performance I split my transactions into 10,000 rows. I insert +> roughly 5000 rows into table A for every 10,000 rows into table B. +> +> Table A has one unique index: +> +> "order_main_pk" UNIQUE, btree (cl_ord_id) +> +> Table B has 1 unique index and 2 non-unique indexes: +> +> "order_transition_pk" UNIQUE, btree (collating_seq) +> "order_transition_ak2" btree (orig_cl_ord_id) +> "order_transition_ak3" btree (exec_id) + +Do you have any foreign key references? +If you are creating a table for the first time (or loading a large +fraction of the data), it is common to drop the indexes and foreign keys +first, and then insert/copy, and then drop them again. + +Is InnoDB the backend with referential integrity, and true transaction +support? I believe the default backend does not support either (so it is +"cheating" to give you speed, which may be just fine for your needs, +especially since you are willing to run fsync=false). + +I think moving pg_xlog to a dedicated drive (set of drives) could help +your performance. As well as increasing checkpoint_segments. + +I don't know if you gain much by changing the bg_writer settings, if you +are streaming everything in at once, you probably want to have it +written out right away. My understanding is that bg_writer settings are +for the case where you have mixed read and writes going on at the same +time, and you want to make sure that the reads have time to execute (ie +the writes are not saturating your IO). + +Also, is any of this tested under load? Having a separate process issue +queries while you are loading in data. Traditionally MySQL is faster +with a single process inserting/querying for data, but once you have +multiple processes hitting it at the same time, it's performance +degrades much faster than postgres. + +You also seem to be giving MySQL 512M of ram to work with, while only +giving 2M/200M to postgres. (re)creating indexes uses +maintenance_work_mem, but updating indexes could easily use work_mem. +You may be RAM starved. + +John +=:-> + + +> +> My testing environment is as follows: +> -Postgresql 8.0.1 +> -libpqxx 2.5.0 +> -Linux 2.6.11.4-21.7-smp x86_64 +> -Dual Opteron 246 +> -System disk (postgres data resides on this SCSI disk) - Seagate +> (ST373453LC) - 15K, 73 GB +> (http://www.seagate.com/cda/products/discsales/marketing/detail/0,1081,549,00.html) +> -2nd logical disk - 10K, 36GB IBM SCSI (IC35L036UCDY10-0) - WAL reside +> on this disk +> -NO RAID +> +> *PostgreSQL* +> Here are the results of copying in 10M rows as fast as possible: +> (10K/transaction) +> Total Time: 1129.556 s +> Rows/sec: 9899.922 +> Transaction>1.2s 225 +> Transaction>1.5s 77 +> Transaction>2.0s 4 +> Max Transaction 2.325s +> +> **MySQL** +> **I ran a similar test with MySQL 4.1.10a (InnoDB) which produced these +> results: (I used MySQL's INSERT INTO x VALUES +> (1,2,3)(4,5,6)(...,...,...) syntax) (10K/transaction) +> Total Time: 860.000 s +> Rows/sec: 11627.91 +> Transaction>1.2s 0 +> Transaction>1.5s 0 +> Transaction>2.0s 0 +> Max Transaction 1.175s +> +> Considering the configurations shown below, can anyone offer advice to +> close the 15% gap and the much worse variability I'm experiencing. Thanks +> +> My *postgresql.conf* has the following non-default values: +> # ----------------------------- +> # PostgreSQL configuration file +> # ----------------------------- +> listen_addresses = '*' # what IP interface(s) to listen on; +> max_connections = 100 +> #--------------------------------------------------------------------------- +> # RESOURCE USAGE (except WAL) +> #--------------------------------------------------------------------------- +> shared_buffers = 65536 # min 16, at least max_connections*2, 8KB each +> work_mem = 2048 # min 64, size in KB +> maintenance_work_mem = 204800 # min 1024, size in KB +> max_fsm_pages = 2250000 # min max_fsm_relations*16, 6 bytes each +> bgwriter_delay = 200 # 10-10000 milliseconds between rounds +> bgwriter_percent = 10 # 0-100% of dirty buffers in each round +> bgwriter_maxpages = 1000 # 0-1000 buffers max per round +> #--------------------------------------------------------------------------- +> # WRITE AHEAD LOG +> #--------------------------------------------------------------------------- +> fsync = false # turns forced synchronization on or off +> wal_buffers = 64 # min 4, 8KB each +> checkpoint_segments = 40 # in logfile segments, min 1, 16MB each +> checkpoint_timeout = 600 # range 30-3600, in seconds +> #--------------------------------------------------------------------------- +> # QUERY TUNING +> #--------------------------------------------------------------------------- +> effective_cache_size = 65536 # typically 8KB each +> random_page_cost = 2 # units are one sequential page fetch cost +> #--------------------------------------------------------------------------- +> # ERROR REPORTING AND LOGGING +> #--------------------------------------------------------------------------- +> +> log_min_duration_statement = 250 # -1 is disabled, in milliseconds. +> log_connections = true +> log_disconnections = true +> log_duration = true +> log_line_prefix = '<%r%u%p%t%d%%' # 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 = 'none' # none, mod, ddl, all +> #--------------------------------------------------------------------------- +> # RUNTIME STATISTICS +> #--------------------------------------------------------------------------- +> # - Query/Index Statistics Collector - +> stats_start_collector = true +> stats_command_string = true +> stats_block_level = true +> stats_row_level = true +> stats_reset_on_server_start = true +> +> My MySQL *my.ini* has the following non default values: +> innodb_data_home_dir = /var/lib/mysql/ +> innodb_data_file_path = ibdata1:10M:autoextend +> innodb_log_group_home_dir = /var/lib/mysql/ +> innodb_log_arch_dir = /var/lib/mysql/ +> # You can set .._buffer_pool_size up to 50 - 80 % +> # of RAM but beware of setting memory usage too high +> innodb_buffer_pool_size = 512M +> innodb_additional_mem_pool_size = 64M +> # Set .._log_file_size to 25 % of buffer pool size +> innodb_log_file_size = 128M +> innodb_log_buffer_size = 64M +> innodb_flush_log_at_trx_commit = 1 +> innodb_lock_wait_timeout = 50 +> innodb_flush_method = O_DSYNC +> max_allowed_packet = 16M +> +> +> + + +--------------enig409DCEA0AEEAA541DD15189C +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC5XDxJdeBCYSNAAMRAu8tAJ9DW0ixS8RCamqhXjo9x/AU2MjKOwCfR5Ku +g0RlPleYCcbP+4F/kBfNhxg= +=/FaG +-----END PGP SIGNATURE----- + +--------------enig409DCEA0AEEAA541DD15189C-- + +From pgsql-performance-owner@postgresql.org Mon Jul 25 20:20:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B070D52F04 + for ; + Mon, 25 Jul 2005 20:14:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 22483-02 + for ; + Mon, 25 Jul 2005 23:14:22 +0000 (GMT) +Received: from wsmailap01.firstam.com (outbound-smtp01.firstam.com + [208.246.101.197]) + by svr1.postgresql.org (Postfix) with ESMTP id 541B252E0C + for ; + Mon, 25 Jul 2005 20:14:21 -0300 (ADT) +Received: from 172.21.131.5 by wsmailap02.firstam.com with ESMTP ( + Tumbleweed MMS SMTP Relay (MMS v5.6.3)); Mon, 25 Jul 2005 16:14:07 + -0700 +X-Server-Uuid: 7F57BFB8-2F8F-44C6-8C75-DD639B93CEA6 +Received: from anammx01.ana.firstamdata.com ([192.168.173.35]) by + famarp01.firstam.com (MOS 3.5.6-GR) with SMTP id EGA36864; Mon, 25 Jul + 2005 16:14:17 -0700 (PDT) +Received: from pisgana01sxch21.ana.firstamdata.com (Not + Verified[192.168.173.71]) by mailgateway.firstam.com (post.office MTA + v5.0 0924 ) with ESMTP id ; Mon, 25 Jul 2005 16:14:17 -0700 +Received: from pisgana01sxch01.ana.firstamdata.com ([192.168.173.70]) by + pisgana01sxch21.ana.firstamdata.com with Microsoft SMTPSVC(6.0.3790.211 + ); Mon, 25 Jul 2005 16:14:17 -0700 +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: Re: "Vacuum Full Analyze" taking so long +Date: Mon, 25 Jul 2005 16:14:16 -0700 +Message-ID: + +Thread-Topic: [PERFORM] "Vacuum Full Analyze" taking so long +Thread-Index: AcWRazJ1+TPBVbzoS0KsnTmbFkEs4wAAk6ng +From: "Tomeh, Husam" +To: "Luke Lonergan" , + pgsql-performance@postgresql.org +X-OriginalArrivalTime: 25 Jul 2005 23:14:17.0282 (UTC) + FILETIME=[94717220:01C5916E] +X-WSS-ID: 6EFBADB523K977078-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.027 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/373 +X-Sequence-Number: 13614 + +=20 +Nothing was running except the job. The server did not look stressed out +looking at top and vmstat. We have seen slower query performance when +performing load tests, so I run the re-index on all application indexes +and then issue a full vacuum. I ran the same thing on a staging server +and it took less than 12 hours. Is there a possibility the DB pages are +corrupted. Is there a command to verify that. (In Oracle, there's a +dbverify command that checks for corruption on the data files level).=20 + +The other question I have. What would be the proper approach to rebuild +indexes. I re-indexes and then run vacuum/analyze. Should I not use the +re-index approach, and instead, drop the indexes, vacuum the tables, and +then create the indexes, then run analyze on tables and indexes??=20 + +Thanks, + + +--=20 +=20Husam=20 + +-----Original Message----- +From: Luke Lonergan [mailto:llonergan@greenplum.com]=20 +Sent: Monday, July 25, 2005 3:49 PM +To: Tomeh, Husam; pgsql-performance@postgresql.org +Subject: Re: [PERFORM] "Vacuum Full Analyze" taking so long + +Vacuum full takes an exclusive lock on the tables it runs against, so if +you have anything else reading the table while you are trying to run it, +the vacuum full will wait, possibly forever until it can get the lock. + +What does the system load look like while you are running this? What +does vmstat 1 show you? Is there load on the system other than the +database? + +Do you really need to run vacuum full instead of vacuum? + +- Luke + + +On 7/25/05 2:30 PM, "Tomeh, Husam" wrote: + +> =20 +> I have an 8.02 postgresql database with about 180 GB in size, running=20 +> on +> 2.6 RedHat kernel with 32 GB of RAM and 2 CPUs. I'm running the vacuum + +> full analyze command, and has been running for at least two=20 +> consecutive days with no other processes running (it's an offline=20 +> loading server). I tweaked the maintenanace_mem to its max (2 GB) with + +> work_mem of 8M. I have no issues with my checkpoints. I can still I/O=20 +> activities against the physical files of the "property" table and its=20 +> two indexes (primary key and r index). The property files are about=20 +> 128GB and indexes are about 15 GB. I have run the same maintenance job + +> on a different box +> (staging) with identical hardware config (except with 64 GB instead of +> 32) and took less than 12 hours. Any clue or tip is really +> appreciated.=20 +>=20 +> Also read a comment by Tom Lane, that terminating the process should=20 +> be crash-safe if I had to. +>=20 +> Thanks, +>=20 + + + +********************************************************************** +This message contains confidential information intended only for the=20 +use of the addressee(s) named above and may contain information that=20 +is legally privileged. If you are not the addressee, or the person=20 +responsible for delivering it to the addressee, you are hereby=20 +notified that reading, disseminating, distributing or copying this=20 +message is strictly prohibited. If you have received this message by=20 +mistake, please immediately notify us by replying to the message and=20 +delete the original message immediately thereafter. + +Thank you. FADLD Tag +********************************************************************** + + +From pgsql-performance-owner@postgresql.org Mon Jul 25 23:21:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7E6EB52C48 + for ; + Mon, 25 Jul 2005 20:31:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25483-03 + for ; + Mon, 25 Jul 2005 23:31:13 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id 5D18452FE9 + for ; + Mon, 25 Jul 2005 20:31:12 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050725233116m9200g50sde>; Mon, 25 Jul 2005 23:31:16 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 614E75600C; Mon, 25 Jul 2005 18:31:15 -0500 (CDT) +Received: from [192.168.1.112] (71-32-73-140.cdrr.qwest.net [71.32.73.140]) + by juju.arbash-meinel.com (Postfix) with ESMTP id B59EE55FB5; + Mon, 25 Jul 2005 18:31:11 -0500 (CDT) +Message-ID: <42E5763C.7030804@arbash-meinel.com> +Date: Mon, 25 Jul 2005 18:31:08 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Tomeh, Husam" +Cc: Luke Lonergan , pgsql-performance@postgresql.org +Subject: Re: "Vacuum Full Analyze" taking so long +References: + +In-Reply-To: + +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig4E54487029FFB447F5276BE0" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/379 +X-Sequence-Number: 13620 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig4E54487029FFB447F5276BE0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Tomeh, Husam wrote: +> +> Nothing was running except the job. The server did not look stressed out +> looking at top and vmstat. We have seen slower query performance when +> performing load tests, so I run the re-index on all application indexes +> and then issue a full vacuum. I ran the same thing on a staging server +> and it took less than 12 hours. Is there a possibility the DB pages are +> corrupted. Is there a command to verify that. (In Oracle, there's a +> dbverify command that checks for corruption on the data files level). +> +> The other question I have. What would be the proper approach to rebuild +> indexes. I re-indexes and then run vacuum/analyze. Should I not use the +> re-index approach, and instead, drop the indexes, vacuum the tables, and +> then create the indexes, then run analyze on tables and indexes?? + +I *think* if you are planning on dropping the indexes anyway, just drop +them, VACUUM ANALYZE, and then recreate them, I don't think you have to +re-analyze after you have recreated them. + +John +=:-> + +> +> Thanks, +> +> + + +--------------enig4E54487029FFB447F5276BE0 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC5XY9JdeBCYSNAAMRAip9AKClCCUdHAiQHR1kfGxOqBXhgBbv5QCgnxhV +DVswER6oKm+snqzCAuuLXgk= +=vFll +-----END PGP SIGNATURE----- + +--------------enig4E54487029FFB447F5276BE0-- + +From pgsql-performance-owner@postgresql.org Mon Jul 25 23:11:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A89EA52E8E + for ; + Mon, 25 Jul 2005 21:31:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38776-02 + for ; + Tue, 26 Jul 2005 00:31:08 +0000 (GMT) +Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 8543352B57 + for ; + Mon, 25 Jul 2005 21:31:06 -0300 (ADT) +Received: from 172.16.1.118 by mail.Mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D1)); Mon, 25 Jul 2005 20:31:03 -0400 +X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 25 Jul + 2005 20:31:03 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Mon, 25 Jul + 2005 20:31:02 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Mon, 25 Jul 2005 17:31:02 -0700 +Subject: Re: COPY insert performance +From: "Luke Lonergan" +To: "Chris Isaacson" , + pgsql-performance@postgresql.org +Message-ID: +In-Reply-To: <07774C6E31D94A44A2A60E2085944F09071DF0@tbmail.tradebot.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 26 Jul 2005 00:31:03.0123 (UTC) + FILETIME=[4DBD0230:01C59179] +X-WSS-ID: 6EFB5BCD2B46231971-01-01 +Content-Type: multipart/alternative; + boundary=B_3205157462_11232091 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.718 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, HTML_30_40, HTML_FONT_BIG, HTML_MESSAGE, + RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/378 +X-Sequence-Number: 13619 + +> This message is in MIME format. Since your mail reader does not understand +this format, some or all of this message may not be legible. + +--B_3205157462_11232091 +Content-Type: text/plain; + charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable + +Chris, + +You can try the Bizgres distribution of postgres (based on version 8.0.3), +the COPY support is 30% faster as reported by OSDL (without indexes). This +is due to very slow parsing within the COPY command, which is sped up using +micro-optimized logic for parsing. There is a patch pending for the +development version of Postgres which implements the same code, but you can +use Bizgres and get it now instead of waiting for postgres 8.1 to come out. +Also, Bizgres is QA tested with the enhanced features. + +Bizgres is a free / open source distribution of Postgres for Business +Intelligence / Data Warehousing. + +Bizgres currently features postgres 8.0.3 plus these patches: +* Bypass WAL when performing =B3CREATE TABLE AS SELECT=B2 +* COPY is between 30% and 90% faster on machines with fast I/O +* Enhanced support for data partitioning with partition elimination +optimization=20 +* Bitmap Scan support for multiple index use in queries and better low +cardinality column performance +* Improved optimization of queries with LIMIT + +See: http://www.bizgres.org for more. + +- Luke + + +On 7/25/05 3:32 PM, "Chris Isaacson" wrote: + +> I need COPY via libpqxx to insert millions of rows into two tables. One = +table +> has roughly have as many rows and requires half the storage. In producti= +on, +> the largest table will grow by ~30M rows/day. To test the COPY performan= +ce I +> split my transactions into 10,000 rows. I insert roughly 5000 rows into = +table +> A for every 10,000 rows into table B. +> =20 +> Table A has one unique index: +> =20 +> "order_main_pk" UNIQUE, btree (cl_ord_id) +> =20 +> Table B has 1 unique index and 2 non-unique indexes: +> =20 +> "order_transition_pk" UNIQUE, btree (collating_seq) +> "order_transition_ak2" btree (orig_cl_ord_id) +> "order_transition_ak3" btree (exec_id) +> =20 +> My testing environment is as follows: +> -Postgresql 8.0.1 +> -libpqxx 2.5.0 +> -Linux 2.6.11.4-21.7-smp x86_64 +> -Dual Opteron 246 +> -System disk (postgres data resides on this SCSI disk) - Seagate (ST3734= +53LC) +> - 15K, 73 GB=20 +> (http://www.seagate.com/cda/products/discsales/marketing/detail/0,1081,54= +9,00. +> html) +> -2nd logical disk - 10K, 36GB IBM SCSI (IC35L036UCDY10-0) - WAL reside on= + this +> disk +> -NO RAID +> =20 +> PostgreSQL +> Here are the results of copying in 10M rows as fast as possible: +> (10K/transaction) +> Total Time: 1129.556 s +> Rows/sec: 9899.922 +> Transaction>1.2s 225 +> Transaction>1.5s 77 +> Transaction>2.0s 4 +> Max Transaction 2.325s +> =20 +> MySQL +> I ran a similar test with MySQL 4.1.10a (InnoDB) which produced these res= +ults: +> (I used MySQL's INSERT INTO x VALUES (1,2,3)(4,5,6)(...,...,...) syntax) +> (10K/transaction) +> Total Time: 860.000 s +> Rows/sec: 11627.91 +> Transaction>1.2s 0 +> Transaction>1.5s 0 +> Transaction>2.0s 0 +> Max Transaction 1.175s +> =20 +> Considering the configurations shown below, can anyone offer advice to cl= +ose +> the 15% gap and the much worse variability I'm experiencing. Thanks +> =20 +> My postgresql.conf has the following non-default values: +> # ----------------------------- +> # PostgreSQL configuration file +> # ----------------------------- +> listen_addresses =3D '*' # what IP interface(s) to listen on; +> max_connections =3D 100 +> #------------------------------------------------------------------------= +--- +> # RESOURCE USAGE (except WAL) +> #------------------------------------------------------------------------= +--- +> shared_buffers =3D 65536 # min 16, at least max_connections*2, 8KB each +> work_mem =3D 2048 # min 64, size in KB +> maintenance_work_mem =3D 204800 # min 1024, size in KB +> max_fsm_pages =3D 2250000 # min max_fsm_relations*16, 6 bytes each +> bgwriter_delay =3D 200 # 10-10000 milliseconds between rounds +> bgwriter_percent =3D 10 # 0-100% of dirty buffers in each round +> bgwriter_maxpages =3D 1000 # 0-1000 buffers max per round +> #------------------------------------------------------------------------= +--- +> # WRITE AHEAD LOG +> #------------------------------------------------------------------------= +--- +> fsync =3D false # turns forced synchronization on or off +> wal_buffers =3D 64 # min 4, 8KB each +> checkpoint_segments =3D 40 # in logfile segments, min 1, 16MB each +> checkpoint_timeout =3D 600 # range 30-3600, in seconds +> #------------------------------------------------------------------------= +--- +> # QUERY TUNING +> #------------------------------------------------------------------------= +--- +> effective_cache_size =3D 65536 # typically 8KB each +> random_page_cost =3D 2 # units are one sequential page fetch cost +> #------------------------------------------------------------------------= +--- +> # ERROR REPORTING AND LOGGING +> #------------------------------------------------------------------------= +--- +> log_min_duration_statement =3D 250 # -1 is disabled, in milliseconds. +> log_connections =3D true +> log_disconnections =3D true +> log_duration =3D true +> log_line_prefix =3D '<%r%u%p%t%d%%' # e.g. '<%u%%%d> ' +> # %u=3Duser name %d=3Ddatabase name +> # %r=3Dremote host and port +> # %p=3DPID %t=3Dtimestamp %i=3Dcommand tag +> # %c=3Dsession id %l=3Dsession line number +> # %s=3Dsession start timestamp %x=3Dtransaction id +> # %q=3Dstop here in non-session processes +> # %%=3D'%' +> log_statement =3D 'none' # none, mod, ddl, all +> #------------------------------------------------------------------------= +--- +> # RUNTIME STATISTICS +> #------------------------------------------------------------------------= +--- +> # - Query/Index Statistics Collector - +> stats_start_collector =3D true +> stats_command_string =3D true +> stats_block_level =3D true +> stats_row_level =3D true +> stats_reset_on_server_start =3D true +> =20 +> My MySQL my.ini has the following non default values: +> innodb_data_home_dir =3D /var/lib/mysql/ +> innodb_data_file_path =3D ibdata1:10M:autoextend +> innodb_log_group_home_dir =3D /var/lib/mysql/ +> innodb_log_arch_dir =3D /var/lib/mysql/ +> # You can set .._buffer_pool_size up to 50 - 80 % +> # of RAM but beware of setting memory usage too high +> innodb_buffer_pool_size =3D 512M +> innodb_additional_mem_pool_size =3D 64M +> # Set .._log_file_size to 25 % of buffer pool size +> innodb_log_file_size =3D 128M +> innodb_log_buffer_size =3D 64M +> innodb_flush_log_at_trx_commit =3D 1 +> innodb_lock_wait_timeout =3D 50 +> innodb_flush_method =3D O_DSYNC +> max_allowed_packet =3D 16M +> =20 +> =20 +> =20 +>=20 + + + +--B_3205157462_11232091 +Content-Type: text/html; + charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable + + + +Re: [PERFORM] COPY insert performance + + +Chris= +,
+
+You can try the Bizgres distribution of postgres (based on version 8.0.3), = +the COPY support is 30% faster as reported by OSDL (without indexes).  = +This is due to very slow parsing within the COPY command, which is sped up u= +sing micro-optimized logic for parsing.  There is a patch pending for t= +he development version of Postgres which implements the same code, but you c= +an use Bizgres and get it now instead of waiting for postgres 8.1 to come ou= +t.  Also, Bizgres is QA tested with the enhanced features.
+
+Bizgres is a free / open source distribution of Postgres for Business Intel= +ligence / Data Warehousing.
+
+Bizgres currently features postgres 8.0.3 plus these patches:
+
  • Bypass WAL when performing “CREATE TABLE AS SELECT= +221; +
  • COPY is between 30% and 90% faster on machines with fast I/O +
  • Enhanced support for data partitioning with partition eliminati= +on optimization +
  • Bitmap Scan support for multiple index use in queries and bette= +r low cardinality column performance +
  • Improved optimization of queries with LIMIT
    +

+See: http://www.bizgres.org for more.<= +BR> +
+- Luke
+
+
+On 7/25/05 3:32 PM, "Chris Isaacson" <cisaacson@tradebotsystem= +s.com> wrote:
+
+
I need COPY via libpqxx to insert millions of rows into two tables.  O= +ne table has roughly have as many rows and requires half the storage.  = +In production, the largest table will grow by ~30M rows/day.  To test t= +he COPY performance I split my transactions into 10,000 rows.  I insert= + roughly 5000 rows into table A for every 10,000 rows into table B.
+

+
Table A has one unique index:
+

+
"order_main_pk" UNIQUE, btree (cl_ord_i= +d)
+

+
Table B has 1 unique index and 2 non-unique index= +es:
+

+
"order_transition_pk" UNIQUE, btree (co= +llating_seq)
+"order_transition_ak2" btree (orig_cl_ord_id)
+"order_transition_ak3" btree (exec_id)
+

+
My testing environment is as follows:
+-Postgresql 8.0.1
+-libpqxx 2.5.0
+-Linux 2.6.11.4-21.7-smp x86_64
+-Dual Opteron 246
+-System disk (postgres data resides on this SCSI disk) -
Seag= +ate (ST373453LC) - 15K, 73 GB (http://www.seagate.com/cda/p= +roducts/discsales/marketing/detail/0,1081,549,00.html)
+
-2nd logical disk - 10K, 36GB IBM SCSI (IC35L036UCDY10-0) - = +WAL reside on this disk
+-NO RAID

+
PostgreS= +QL
+
Here are the results of copying in 10M rows as fast as possible: (10K/t= +ransaction)
+Total Time:           &nb= +sp;1129.556 s
+Rows/sec:            = +; 9899.922
+Transaction>1.2s    225
+Transaction>1.5s     77
+Transaction>2.0s      4
+Max Transaction       2.325s

+MySQL
+
I ran a similar test with MySQL 4.1.10a (InnoDB) which produced these r= +esults: (I used MySQL's INSERT INTO x VALUES (1,2,3)(4,5,6)(...,...,...) syn= +tax) (10K/transaction)
+Total Time:         860.000 s
+Rows/sec:        11627.91
+Transaction>1.2s      0
+Transaction>1.5s      0
+Transaction>2.0s      0
+Max Transaction       1.175s

+Considering the configurations shown below, can anyone offer advice to clos= +e the 15% gap and the much worse variability I'm experiencing.  Thanks<= +BR> +

+
My postgresql.conf has the following non-d= +efault values:
+# -----------------------------
+# PostgreSQL configuration file
+# -----------------------------
+listen_addresses =3D '*' # what IP interface(s) to listen on;
+max_connections =3D 100
+#--------------------------------------------------------------------------= +-
+# RESOURCE USAGE (except WAL)
+#--------------------------------------------------------------------------= +-
+shared_buffers =3D 65536  # min 16, at least max_connections*2, 8KB each= +
+work_mem =3D 2048   # min 64, size in KB
+maintenance_work_mem =3D 204800 # min 1024, size in KB
+max_fsm_pages =3D 2250000  # min max_fsm_relations*16, 6 bytes each
+bgwriter_delay =3D 200  # 10-10000 milliseconds between rounds
+bgwriter_percent =3D 10  # 0-100% of dirty buffers in each round
+bgwriter_maxpages =3D 1000 # 0-1000 buffers max per round
+#--------------------------------------------------------------------------= +-
+# WRITE AHEAD LOG
+#--------------------------------------------------------------------------= +-
+fsync =3D false   # turns forced synchronization on or off
+wal_buffers =3D 64  # min 4, 8KB each
+checkpoint_segments =3D 40 # in logfile segments, min 1, 16MB each
+checkpoint_timeout =3D 600 # range 30-3600, in seconds
+#--------------------------------------------------------------------------= +-
+# QUERY TUNING
+#--------------------------------------------------------------------------= +-
+effective_cache_size =3D 65536 # typically 8KB each
+random_page_cost =3D 2  # units are one sequential page fetch cost
+#--------------------------------------------------------------------------= +-
+# ERROR REPORTING AND LOGGING
+#--------------------------------------------------------------------------= +-   
+log_min_duration_statement =3D    250 # -1 is disabled, in mil= +liseconds.
+log_connections =3D true
+log_disconnections =3D true
+log_duration =3D true
+log_line_prefix =3D '<%r%u%p%t%d%%'  # e.g. '<%u%%%d> '
+    # %u=3Duser name %d=3Ddatabase name
+    # %r=3Dremote host and port
+    # %p=3DPID %t=3Dtimestamp %i=3Dcommand tag
+    # %c=3Dsession id %l=3Dsession line number
+    # %s=3Dsession start timestamp %x=3Dtransaction id
+    # %q=3Dstop here in non-session processes
+    # %%=3D'%'
+log_statement =3D 'none'  # none, mod, ddl, all
+#--------------------------------------------------------------------------= +-
+# RUNTIME STATISTICS
+#--------------------------------------------------------------------------= +-
+# - Query/Index Statistics Collector -
+stats_start_collector =3D true
+stats_command_string =3D true
+stats_block_level =3D true
+stats_row_level =3D true
+stats_reset_on_server_start =3D true
+

+
My MySQL my.ini has the following non defa= +ult values:
+innodb_data_home_dir =3D /var/lib/mysql/
+innodb_data_file_path =3D ibdata1:10M:autoextend
+innodb_log_group_home_dir =3D /var/lib/mysql/
+innodb_log_arch_dir =3D /var/lib/mysql/
+# You can set .._buffer_pool_size up to 50 - 80 %
+# of RAM but beware of setting memory usage too high
+innodb_buffer_pool_size =3D 512M
+innodb_additional_mem_pool_size =3D 64M
+# Set .._log_file_size to 25 % of buffer pool size
+innodb_log_file_size =3D 128M
+innodb_log_buffer_size =3D 64M
+innodb_flush_log_at_trx_commit =3D 1
+innodb_lock_wait_timeout =3D 50
+innodb_flush_method =3D O_DSYNC
+max_allowed_packet =3D 16M
+


+

+

+

+
+ + + + +--B_3205157462_11232091-- + + +From pgsql-performance-owner@postgresql.org Mon Jul 25 23:10:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BE28352BDC + for ; + Mon, 25 Jul 2005 21:52:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 41807-09 + for ; + Tue, 26 Jul 2005 00:51:51 +0000 (GMT) +Received: from mail.Mi8.com (mail.mi8.com [63.240.6.50]) + by svr1.postgresql.org (Postfix) with ESMTP id 6414852BB6 + for ; + Mon, 25 Jul 2005 21:51:50 -0300 (ADT) +Received: from 172.16.1.118 by mail.Mi8.com with ESMTP (- GW05 Welcome + to Mi8 Corporation www.Mi8.com); Mon, 25 Jul 2005 20:51:49 -0400 +X-Server-Uuid: E0C866E6-C6CD-48B5-AE61-E57E73CF3CC7 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 25 Jul + 2005 20:51:49 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Mon, 25 Jul + 2005 20:51:48 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Mon, 25 Jul 2005 17:51:48 -0700 +Subject: Re: "Vacuum Full Analyze" taking so long +From: "Luke Lonergan" +To: "John A Meinel" , + "Tomeh, Husam" +Cc: pgsql-performance@postgresql.org +Message-ID: +In-Reply-To: <42E5763C.7030804@arbash-meinel.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 26 Jul 2005 00:51:49.0530 (UTC) + FILETIME=[34A79FA0:01C5917C] +X-WSS-ID: 6EFB56AF1M812745206-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, hits=1.576 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/377 +X-Sequence-Number: 13618 + + +Husam, + +On 7/25/05 4:31 PM, "John A Meinel" wrote: + +> Tomeh, Husam wrote: +>> +>> Nothing was running except the job. The server did not look stressed out +>> looking at top and vmstat. We have seen slower query performance when +>> performing load tests, so I run the re-index on all application indexes +>> and then issue a full vacuum. I ran the same thing on a staging server +>> and it took less than 12 hours. Is there a possibility the DB pages are +>> corrupted. Is there a command to verify that. (In Oracle, there's a +>> dbverify command that checks for corruption on the data files level). +>> +>> The other question I have. What would be the proper approach to rebuild +>> indexes. I re-indexes and then run vacuum/analyze. Should I not use the +>> re-index approach, and instead, drop the indexes, vacuum the tables, and +>> then create the indexes, then run analyze on tables and indexes?? +> +> I *think* if you are planning on dropping the indexes anyway, just drop +> them, VACUUM ANALYZE, and then recreate them, I don't think you have to +> re-analyze after you have recreated them. + +I agree - and don't run "VACUUM FULL", it is quite different from "VACUUM". +Also - you should only need to vacuum if you've deleted a lot of data. It's +job is to reclaim space lost to rows marked deleted. So, in fact, you may +not even need to run VACUUM. + +"VACUUM FULL" is like a disk defragmentation operation within the DBMS, and +is only necessary if there is a slowdown in performance from lots and lots +of deletes and/or updates and new data isn't finding sequential pages for +storage, which is rare. Given the need for locking, it's generally better +to dump and restore in that case, but again it's a very rare occasion. + +I don't know of a command to check for page corruption, but I would think +that if you can run VACUUM (not full) you should be OK. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 06:58:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id ED96952EAD + for ; + Tue, 26 Jul 2005 06:58:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60078-06 + for ; + Tue, 26 Jul 2005 09:58:24 +0000 (GMT) +Received: from mailservice.tudelft.nl (mailservice.tudelft.nl [130.161.131.5]) + by svr1.postgresql.org (Postfix) with ESMTP id C8B5F52EF2 + for ; + Tue, 26 Jul 2005 06:58:19 -0300 (ADT) +Received: from localhost (localhost [127.0.0.1]) + by rav.antivirus (Postfix) with ESMTP id CC1F080184 + for ; + Tue, 26 Jul 2005 11:58:21 +0200 (CEST) +Received: from [130.161.3.219] (oli219.office.oli.tudelft.nl [130.161.3.219]) + by mx4.tudelft.nl (Postfix) with ESMTP id 0F29380183 + for ; + Tue, 26 Jul 2005 11:58:21 +0200 (CEST) +Message-ID: <42E60939.9010905@oli.tudelft.nl> +Date: Tue, 26 Jul 2005 11:58:17 +0200 +From: Jochem van Dieten +Organization: OnLine Internet +User-Agent: Mozilla Thunderbird 1.0.5 (Windows/20050711) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: "Vacuum Full Analyze" taking so long +References: + +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at tudelft.nl +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/380 +X-Sequence-Number: 13621 + +Tomeh, Husam wrote: +> The other question I have. What would be the proper approach to rebuild +> indexes. I re-indexes and then run vacuum/analyze. Should I not use the +> re-index approach, and instead, drop the indexes, vacuum the tables, and +> then create the indexes, then run analyze on tables and indexes?? + +If you just want to rebuild indexes, just drop and recreate. + +However, you are also running a VACUUM FULL, so I presume you +have deleted a significant number of rows and want to recover the +space that was in use by them. In that scenario, it is often +better to CLUSTER the table to force a rebuild. While VACUUM FULL +moves the tuples around inside the existing file(s), CLUSTER +simply creates new file(s), moves all the non-deleted tuples +there and then swaps the old and the new files. There can be a +significant performance increase in doing so (but you obviously +need to have some free diskspace). +If you CLUSTER your table it will be ordered by the index you +specify. There can be a performance increase in doing so, but if +you don't want to you can also do a no-op ALTER TABLE and change +a column to a datatype that is the same as it already has. This +too will force a rewrite of the table but without ordering the +tuples. + +So in short my recommendations: +- to rebuild indexes, just drop and recreate the indexes +- to rebuild everything because there is space that can +bepermanently reclaimed, drop indexes, cluster or alter the +table, recreate the indexes and anlyze the table + +Jochem + +From pgsql-performance-owner@postgresql.org Tue Jul 26 09:12:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 73AD552E5C + for ; + Tue, 26 Jul 2005 09:12:26 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92478-02 + for ; + Tue, 26 Jul 2005 12:12:20 +0000 (GMT) +Received: from linuxworld.com.au (unknown [203.34.46.50]) + by svr1.postgresql.org (Postfix) with ESMTP id 0794252CC6 + for ; + Tue, 26 Jul 2005 09:12:18 -0300 (ADT) +Received: from linuxworld.com.au (IDENT:swm@localhost.localdomain [127.0.0.1]) + by linuxworld.com.au (8.13.2/8.13.2) with ESMTP id j6QCCMLl015654; + Tue, 26 Jul 2005 22:12:22 +1000 +Received: from localhost (swm@localhost) + by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id + j6QCCL0o015651; Tue, 26 Jul 2005 22:12:22 +1000 +X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs +Date: Tue, 26 Jul 2005 22:12:21 +1000 (EST) +From: Gavin Sherry +X-X-Sender: swm@linuxworld.com.au +To: Chris Isaacson +Cc: pgsql-performance@postgresql.org +Subject: Re: COPY insert performance +In-Reply-To: <07774C6E31D94A44A2A60E2085944F09071DF0@tbmail.tradebot.com> +Message-ID: +References: <07774C6E31D94A44A2A60E2085944F09071DF0@tbmail.tradebot.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/381 +X-Sequence-Number: 13622 + +Hi Chris, + +Have you considered breaking the data into multiple chunks and COPYing +each concurrently? + +Also, have you ensured that your table isn't storing OIDs? + +On Mon, 25 Jul 2005, Chris Isaacson wrote: + +> #----------------------------------------------------------------------- +> ---- +> # RESOURCE USAGE (except WAL) +> #----------------------------------------------------------------------- +> ---- +> shared_buffers = 65536 # min 16, at least max_connections*2, 8KB each + +shared_buffers that high has been shown to affect performance. Try 12000. + +> wal_buffers = 64 # min 4, 8KB each + +Increasing wal_buffers can also have an effect on performance. + +Thanks, + +Gavin + +From pgsql-performance-owner@postgresql.org Tue Jul 26 09:15:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F04B652E46 + for ; + Tue, 26 Jul 2005 09:15:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93010-01 + for ; + Tue, 26 Jul 2005 12:15:12 +0000 (GMT) +Received: from tbmail.tradebot.com + (Tradebot-Systems-1096753.cust-rtr.swbell.net [68.90.170.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 63A7052E56 + for ; + Tue, 26 Jul 2005 09:15:11 -0300 (ADT) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="US-ASCII" +Content-Transfer-Encoding: quoted-printable +Subject: Re: COPY insert performance +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Date: Tue, 26 Jul 2005 07:15:15 -0500 +Message-ID: <07774C6E31D94A44A2A60E2085944F09071DF1@tbmail.tradebot.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] COPY insert performance +Thread-Index: AcWRbc7D9PAWJ1M0SPemeI02RDv+BgAau4hw +From: "Chris Isaacson" +To: "John A Meinel" , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.229 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: * +X-Archive-Number: 200507/382 +X-Sequence-Number: 13623 + +I do not have any foreign keys and I need the indexes on during the +insert/copy b/c in production a few queries heavily dependent on the +indexes will be issued. These queries will be infrequent, but must be +fast when issued. + +I am using InnoDB with MySQL which appears to enforce true transaction +support. (http://dev.mysql.com/doc/mysql/en/innodb-overview.html) If +not, how is InnoDB "cheating"? + +Sorry for the confusion, but pg_xlog is currently on a dedicated drive +(10K SCSI, see below). Would I realize further gains if I had a third +drive and put the indexes on that drive? =20 + +I've played with the checkpoint_segments. I noticed an enormous +improvement increasing from the default to 40, but neglible improvement +thereafter. Do you have a recommendation for a value? + +My bg_writer adjustments were a last ditch effort. I found your advice +correct and realized no gain. I have not tested under a querying load +which is a good next step. I had not thought of the comparative +degradation of MySQL vs. PostgreSQL. + +Thanks for the tip on the RAM usage by indexes. I was under the +incorrect assumption that shared_buffers would take care of this. I'll +increase work_mem to 512MB and rerun my test. I have 1G of RAM, which +is less than we'll be running in production (likely 2G). + +-----Original Message----- +From: John A Meinel [mailto:john@arbash-meinel.com]=20 +Sent: Monday, July 25, 2005 6:09 PM +To: Chris Isaacson; Postgresql Performance +Subject: Re: [PERFORM] COPY insert performance + + +Chris Isaacson wrote: +> I need COPY via libpqxx to insert millions of rows into two tables. =20 +> One table has roughly have as many rows and requires half the storage. + +> In production, the largest table will grow by ~30M rows/day. To test=20 +> the COPY performance I split my transactions into 10,000 rows. I=20 +> insert roughly 5000 rows into table A for every 10,000 rows into table + +> B. +> +> Table A has one unique index: +> +> "order_main_pk" UNIQUE, btree (cl_ord_id) +> +> Table B has 1 unique index and 2 non-unique indexes: +> +> "order_transition_pk" UNIQUE, btree (collating_seq)=20 +> "order_transition_ak2" btree (orig_cl_ord_id) "order_transition_ak3"=20 +> btree (exec_id) + +Do you have any foreign key references? +If you are creating a table for the first time (or loading a large +fraction of the data), it is common to drop the indexes and foreign keys +first, and then insert/copy, and then drop them again. + +Is InnoDB the backend with referential integrity, and true transaction +support? I believe the default backend does not support either (so it is +"cheating" to give you speed, which may be just fine for your needs, +especially since you are willing to run fsync=3Dfalse). + +I think moving pg_xlog to a dedicated drive (set of drives) could help +your performance. As well as increasing checkpoint_segments. + +I don't know if you gain much by changing the bg_writer settings, if you +are streaming everything in at once, you probably want to have it +written out right away. My understanding is that bg_writer settings are +for the case where you have mixed read and writes going on at the same +time, and you want to make sure that the reads have time to execute (ie +the writes are not saturating your IO). + +Also, is any of this tested under load? Having a separate process issue +queries while you are loading in data. Traditionally MySQL is faster +with a single process inserting/querying for data, but once you have +multiple processes hitting it at the same time, it's performance +degrades much faster than postgres. + +You also seem to be giving MySQL 512M of ram to work with, while only +giving 2M/200M to postgres. (re)creating indexes uses +maintenance_work_mem, but updating indexes could easily use work_mem. +You may be RAM starved. + +John +=3D:-> + + +> +> My testing environment is as follows: +> -Postgresql 8.0.1 +> -libpqxx 2.5.0 +> -Linux 2.6.11.4-21.7-smp x86_64 +> -Dual Opteron 246 +> -System disk (postgres data resides on this SCSI disk) - Seagate +> (ST373453LC) - 15K, 73 GB +> (http://www.seagate.com/cda/products/discsales/marketing/detail/0,1081 +> ,549,00.html) +> -2nd logical disk - 10K, 36GB IBM SCSI (IC35L036UCDY10-0) - WAL reside +> on this disk +> -NO RAID +> +> *PostgreSQL* +> Here are the results of copying in 10M rows as fast as possible: +> (10K/transaction) +> Total Time: 1129.556 s +> Rows/sec: 9899.922 +> Transaction>1.2s 225 +> Transaction>1.5s 77 +> Transaction>2.0s 4 +> Max Transaction 2.325s +> +> **MySQL** +> **I ran a similar test with MySQL 4.1.10a (InnoDB) which produced=20 +> these +> results: (I used MySQL's INSERT INTO x VALUES +> (1,2,3)(4,5,6)(...,...,...) syntax) (10K/transaction) +> Total Time: 860.000 s +> Rows/sec: 11627.91 +> Transaction>1.2s 0 +> Transaction>1.5s 0 +> Transaction>2.0s 0 +> Max Transaction 1.175s +> +> Considering the configurations shown below, can anyone offer advice to + +> close the 15% gap and the much worse variability I'm experiencing. =20 +> Thanks +> +> My *postgresql.conf* has the following non-default values: +> # ----------------------------- +> # PostgreSQL configuration file +> # ----------------------------- +> listen_addresses =3D '*' # what IP interface(s) to listen on;=20 +> max_connections =3D 100 +> #--------------------------------------------------------------------- +> ------ +> # RESOURCE USAGE (except WAL) +> +#----------------------------------------------------------------------- +---- +> shared_buffers =3D 65536 # min 16, at least max_connections*2, 8KB = +each +> work_mem =3D 2048 # min 64, size in KB +> maintenance_work_mem =3D 204800 # min 1024, size in KB +> max_fsm_pages =3D 2250000 # min max_fsm_relations*16, 6 bytes each +> bgwriter_delay =3D 200 # 10-10000 milliseconds between rounds +> bgwriter_percent =3D 10 # 0-100% of dirty buffers in each round +> bgwriter_maxpages =3D 1000 # 0-1000 buffers max per round +> +#----------------------------------------------------------------------- +---- +> # WRITE AHEAD LOG +> +#----------------------------------------------------------------------- +---- +> fsync =3D false # turns forced synchronization on or off +> wal_buffers =3D 64 # min 4, 8KB each +> checkpoint_segments =3D 40 # in logfile segments, min 1, 16MB each +> checkpoint_timeout =3D 600 # range 30-3600, in seconds +> +#----------------------------------------------------------------------- +---- +> # QUERY TUNING +> +#----------------------------------------------------------------------- +---- +> effective_cache_size =3D 65536 # typically 8KB each +> random_page_cost =3D 2 # units are one sequential page fetch cost +> +#----------------------------------------------------------------------- +---- +> # ERROR REPORTING AND LOGGING +> +#----------------------------------------------------------------------- +---- +> +> log_min_duration_statement =3D 250 # -1 is disabled, in = +milliseconds. +> log_connections =3D true +> log_disconnections =3D true +> log_duration =3D true +> log_line_prefix =3D '<%r%u%p%t%d%%' # e.g. '<%u%%%d> ' +> # %u=3Duser name %d=3Ddatabase name +> # %r=3Dremote host and port +> # %p=3DPID %t=3Dtimestamp %i=3Dcommand tag +> # %c=3Dsession id %l=3Dsession line number +> # %s=3Dsession start timestamp %x=3Dtransaction id +> # %q=3Dstop here in non-session processes +> # %%=3D'%' +> log_statement =3D 'none' # none, mod, ddl, all +> #--------------------------------------------------------------------- +> ------ +> # RUNTIME STATISTICS +> +#----------------------------------------------------------------------- +---- +> # - Query/Index Statistics Collector - +> stats_start_collector =3D true +> stats_command_string =3D true +> stats_block_level =3D true +> stats_row_level =3D true +> stats_reset_on_server_start =3D true +> +> My MySQL *my.ini* has the following non default values:=20 +> innodb_data_home_dir =3D /var/lib/mysql/ innodb_data_file_path =3D=20 +> ibdata1:10M:autoextend innodb_log_group_home_dir =3D /var/lib/mysql/ +> innodb_log_arch_dir =3D /var/lib/mysql/ +> # You can set .._buffer_pool_size up to 50 - 80 % +> # of RAM but beware of setting memory usage too high +> innodb_buffer_pool_size =3D 512M +> innodb_additional_mem_pool_size =3D 64M +> # Set .._log_file_size to 25 % of buffer pool size +> innodb_log_file_size =3D 128M +> innodb_log_buffer_size =3D 64M +> innodb_flush_log_at_trx_commit =3D 1 +> innodb_lock_wait_timeout =3D 50 +> innodb_flush_method =3D O_DSYNC +> max_allowed_packet =3D 16M +> +> +> + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 09:23:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B4A752E5F + for ; + Tue, 26 Jul 2005 09:23:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92399-08 + for ; + Tue, 26 Jul 2005 12:22:58 +0000 (GMT) +Received: from tbmail.tradebot.com + (Tradebot-Systems-1096753.cust-rtr.swbell.net [68.90.170.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 6F71152E47 + for ; + Tue, 26 Jul 2005 09:22:58 -0300 (ADT) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="US-ASCII" +Content-Transfer-Encoding: quoted-printable +Subject: Re: COPY insert performance +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Date: Tue, 26 Jul 2005 07:23:02 -0500 +Message-ID: <07774C6E31D94A44A2A60E2085944F09071DF2@tbmail.tradebot.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] COPY insert performance +Thread-Index: AcWRbc7D9PAWJ1M0SPemeI02RDv+BgAbrL7g +From: "Chris Isaacson" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.967 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/383 +X-Sequence-Number: 13624 + +John, + +(FYI: got a failed to deliver to john@arbash-meinel.com) + +I do not have any foreign keys and I need the indexes on during the +insert/copy b/c in production a few queries heavily dependent on the +indexes will be issued. These queries will be infrequent, but must be +fast when issued. + +I am using InnoDB with MySQL which appears to enforce true transaction +support. (http://dev.mysql.com/doc/mysql/en/innodb-overview.html) If +not, how is InnoDB "cheating"? + +Sorry for the confusion, but pg_xlog is currently on a dedicated drive +(10K SCSI, see below). Would I realize further gains if I had a third +drive and put the indexes on that drive? =3D20 + +I've played with the checkpoint_segments. I noticed an enormous +improvement increasing from the default to 40, but neglible improvement +thereafter. Do you have a recommendation for a value? + +My bg_writer adjustments were a last ditch effort. I found your advice +correct and realized no gain. I have not tested under a querying load +which is a good next step. I had not thought of the comparative +degradation of MySQL vs. PostgreSQL. + +Thanks for the tip on the RAM usage by indexes. I was under the +incorrect assumption that shared_buffers would take care of this. I'll +increase work_mem to 512MB and rerun my test. I have 1G of RAM, which +is less than we'll be running in production (likely 2G). + +-Chris + +-----Original Message----- +From: John A Meinel [mailto:john@arbash-meinel.com]=20 +Sent: Monday, July 25, 2005 6:09 PM +To: Chris Isaacson; Postgresql Performance +Subject: Re: [PERFORM] COPY insert performance + + +Chris Isaacson wrote: +> I need COPY via libpqxx to insert millions of rows into two tables. =20 +> One table has roughly have as many rows and requires half the storage. + +> In production, the largest table will grow by ~30M rows/day. To test=20 +> the COPY performance I split my transactions into 10,000 rows. I=20 +> insert roughly 5000 rows into table A for every 10,000 rows into table + +> B. +> +> Table A has one unique index: +> +> "order_main_pk" UNIQUE, btree (cl_ord_id) +> +> Table B has 1 unique index and 2 non-unique indexes: +> +> "order_transition_pk" UNIQUE, btree (collating_seq)=20 +> "order_transition_ak2" btree (orig_cl_ord_id) "order_transition_ak3"=20 +> btree (exec_id) + +Do you have any foreign key references? +If you are creating a table for the first time (or loading a large +fraction of the data), it is common to drop the indexes and foreign keys +first, and then insert/copy, and then drop them again. + +Is InnoDB the backend with referential integrity, and true transaction +support? I believe the default backend does not support either (so it is +"cheating" to give you speed, which may be just fine for your needs, +especially since you are willing to run fsync=3Dfalse). + +I think moving pg_xlog to a dedicated drive (set of drives) could help +your performance. As well as increasing checkpoint_segments. + +I don't know if you gain much by changing the bg_writer settings, if you +are streaming everything in at once, you probably want to have it +written out right away. My understanding is that bg_writer settings are +for the case where you have mixed read and writes going on at the same +time, and you want to make sure that the reads have time to execute (ie +the writes are not saturating your IO). + +Also, is any of this tested under load? Having a separate process issue +queries while you are loading in data. Traditionally MySQL is faster +with a single process inserting/querying for data, but once you have +multiple processes hitting it at the same time, it's performance +degrades much faster than postgres. + +You also seem to be giving MySQL 512M of ram to work with, while only +giving 2M/200M to postgres. (re)creating indexes uses +maintenance_work_mem, but updating indexes could easily use work_mem. +You may be RAM starved. + +John +=3D:-> + + +> +> My testing environment is as follows: +> -Postgresql 8.0.1 +> -libpqxx 2.5.0 +> -Linux 2.6.11.4-21.7-smp x86_64 +> -Dual Opteron 246 +> -System disk (postgres data resides on this SCSI disk) - Seagate +> (ST373453LC) - 15K, 73 GB +> (http://www.seagate.com/cda/products/discsales/marketing/detail/0,1081 +> ,549,00.html) +> -2nd logical disk - 10K, 36GB IBM SCSI (IC35L036UCDY10-0) - WAL reside +> on this disk +> -NO RAID +> +> *PostgreSQL* +> Here are the results of copying in 10M rows as fast as possible: +> (10K/transaction) +> Total Time: 1129.556 s +> Rows/sec: 9899.922 +> Transaction>1.2s 225 +> Transaction>1.5s 77 +> Transaction>2.0s 4 +> Max Transaction 2.325s +> +> **MySQL** +> **I ran a similar test with MySQL 4.1.10a (InnoDB) which produced=20 +> these +> results: (I used MySQL's INSERT INTO x VALUES +> (1,2,3)(4,5,6)(...,...,...) syntax) (10K/transaction) +> Total Time: 860.000 s +> Rows/sec: 11627.91 +> Transaction>1.2s 0 +> Transaction>1.5s 0 +> Transaction>2.0s 0 +> Max Transaction 1.175s +> +> Considering the configurations shown below, can anyone offer advice to + +> close the 15% gap and the much worse variability I'm experiencing. =20 +> Thanks +> +> My *postgresql.conf* has the following non-default values: +> # ----------------------------- +> # PostgreSQL configuration file +> # ----------------------------- +> listen_addresses =3D '*' # what IP interface(s) to listen on;=20 +> max_connections =3D 100 +> #--------------------------------------------------------------------- +> ------ +> # RESOURCE USAGE (except WAL) +> +#----------------------------------------------------------------------- +---- +> shared_buffers =3D 65536 # min 16, at least max_connections*2, 8KB = +each +> work_mem =3D 2048 # min 64, size in KB +> maintenance_work_mem =3D 204800 # min 1024, size in KB +> max_fsm_pages =3D 2250000 # min max_fsm_relations*16, 6 bytes each +> bgwriter_delay =3D 200 # 10-10000 milliseconds between rounds +> bgwriter_percent =3D 10 # 0-100% of dirty buffers in each round +> bgwriter_maxpages =3D 1000 # 0-1000 buffers max per round +> +#----------------------------------------------------------------------- +---- +> # WRITE AHEAD LOG +> +#----------------------------------------------------------------------- +---- +> fsync =3D false # turns forced synchronization on or off +> wal_buffers =3D 64 # min 4, 8KB each +> checkpoint_segments =3D 40 # in logfile segments, min 1, 16MB each +> checkpoint_timeout =3D 600 # range 30-3600, in seconds +> +#----------------------------------------------------------------------- +---- +> # QUERY TUNING +> +#----------------------------------------------------------------------- +---- +> effective_cache_size =3D 65536 # typically 8KB each +> random_page_cost =3D 2 # units are one sequential page fetch cost +> +#----------------------------------------------------------------------- +---- +> # ERROR REPORTING AND LOGGING +> +#----------------------------------------------------------------------- +---- +> +> log_min_duration_statement =3D 250 # -1 is disabled, in = +milliseconds. +> log_connections =3D true +> log_disconnections =3D true +> log_duration =3D true +> log_line_prefix =3D '<%r%u%p%t%d%%' # e.g. '<%u%%%d> ' +> # %u=3Duser name %d=3Ddatabase name +> # %r=3Dremote host and port +> # %p=3DPID %t=3Dtimestamp %i=3Dcommand tag +> # %c=3Dsession id %l=3Dsession line number +> # %s=3Dsession start timestamp %x=3Dtransaction id +> # %q=3Dstop here in non-session processes +> # %%=3D'%' +> log_statement =3D 'none' # none, mod, ddl, all +> #--------------------------------------------------------------------- +> ------ +> # RUNTIME STATISTICS +> +#----------------------------------------------------------------------- +---- +> # - Query/Index Statistics Collector - +> stats_start_collector =3D true +> stats_command_string =3D true +> stats_block_level =3D true +> stats_row_level =3D true +> stats_reset_on_server_start =3D true +> +> My MySQL *my.ini* has the following non default values:=20 +> innodb_data_home_dir =3D /var/lib/mysql/ innodb_data_file_path =3D=20 +> ibdata1:10M:autoextend innodb_log_group_home_dir =3D /var/lib/mysql/ +> innodb_log_arch_dir =3D /var/lib/mysql/ +> # You can set .._buffer_pool_size up to 50 - 80 % +> # of RAM but beware of setting memory usage too high +> innodb_buffer_pool_size =3D 512M +> innodb_additional_mem_pool_size =3D 64M +> # Set .._log_file_size to 25 % of buffer pool size +> innodb_log_file_size =3D 128M +> innodb_log_buffer_size =3D 64M +> innodb_flush_log_at_trx_commit =3D 1 +> innodb_lock_wait_timeout =3D 50 +> innodb_flush_method =3D O_DSYNC +> max_allowed_packet =3D 16M +> +> +> + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 09:27:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7CB6852E49 + for ; + Tue, 26 Jul 2005 09:27:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91839-10 + for ; + Tue, 26 Jul 2005 12:27:23 +0000 (GMT) +Received: from tbmail.tradebot.com + (Tradebot-Systems-1096753.cust-rtr.swbell.net [68.90.170.2]) + by svr1.postgresql.org (Postfix) with ESMTP id CADBB52E7F + for ; + Tue, 26 Jul 2005 09:27:22 -0300 (ADT) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="US-ASCII" +Content-Transfer-Encoding: quoted-printable +Subject: Re: COPY insert performance +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Date: Tue, 26 Jul 2005 07:27:25 -0500 +Message-ID: <07774C6E31D94A44A2A60E2085944F09071DF3@tbmail.tradebot.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] COPY insert performance +Thread-Index: AcWR20nD+SAAWU0ETn6FROOSF6Su5wAAcBBg +From: "Chris Isaacson" +To: "Gavin Sherry" , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.876 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/384 +X-Sequence-Number: 13625 + +I need the chunks for each table COPYed within the same transaction +which is why I'm not COPYing concurrently via multiple +threads/processes. I will experiment w/o OID's and decreasing the +shared_buffers and wal_buffers. + +Thanks, +Chris + +-----Original Message----- +From: Gavin Sherry [mailto:swm@alcove.com.au]=20 +Sent: Tuesday, July 26, 2005 7:12 AM +To: Chris Isaacson +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] COPY insert performance + + +Hi Chris, + +Have you considered breaking the data into multiple chunks and COPYing +each concurrently? + +Also, have you ensured that your table isn't storing OIDs? + +On Mon, 25 Jul 2005, Chris Isaacson wrote: + +> #--------------------------------------------------------------------- +> -- +> ---- +> # RESOURCE USAGE (except WAL) +> +#----------------------------------------------------------------------- +> ---- +> shared_buffers =3D 65536 # min 16, at least max_connections*2, 8KB = +each + +shared_buffers that high has been shown to affect performance. Try +12000. + +> wal_buffers =3D 64 # min 4, 8KB each + +Increasing wal_buffers can also have an effect on performance. + +Thanks, + +Gavin + +From pgsql-performance-owner@postgresql.org Tue Jul 26 11:23:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 811BC52ED7 + for ; + Tue, 26 Jul 2005 11:23:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19932-09 + for ; + Tue, 26 Jul 2005 14:23:01 +0000 (GMT) +Received: from sccrmhc14.comcast.net (sccrmhc14.comcast.net [204.127.202.59]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E2FF52EC6 + for ; + Tue, 26 Jul 2005 11:23:00 -0300 (ADT) +Received: from jefftrout.com ([24.147.120.205]) + by comcast.net (sccrmhc14) with SMTP + id <2005072614225901400kb558e>; Tue, 26 Jul 2005 14:23:04 +0000 +Received: (qmail 77981 invoked from network); 26 Jul 2005 14:29:18 -0000 +Received: from c-24-147-120-205.hsd1.ma.comcast.net (HELO ?192.168.0.106?) + (24.147.120.205) + by 192.168.0.109 with SMTP; 26 Jul 2005 14:29:18 -0000 +In-Reply-To: <07774C6E31D94A44A2A60E2085944F09071DF1@tbmail.tradebot.com> +References: <07774C6E31D94A44A2A60E2085944F09071DF1@tbmail.tradebot.com> +Mime-Version: 1.0 (Apple Message framework v733) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <795D0AC7-3C39-4CE3-A105-921F35BAC8DF@torgo.978.org> +Cc: "John A Meinel" , + +Content-Transfer-Encoding: 7bit +From: Jeff Trout +Subject: Re: COPY insert performance +Date: Tue, 26 Jul 2005 10:22:57 -0400 +To: Chris Isaacson +X-Mailer: Apple Mail (2.733) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/385 +X-Sequence-Number: 13626 + + +On Jul 26, 2005, at 8:15 AM, Chris Isaacson wrote: +> +> I am using InnoDB with MySQL which appears to enforce true transaction +> support. (http://dev.mysql.com/doc/mysql/en/innodb-overview.html) If +> not, how is InnoDB "cheating"? +> + +are you sure your tables are innodb? +chances are high unless you explcitly stated "type = innodb" when +creating that they are myisam. + +look at "show table status" output to verify. + +> +> I've played with the checkpoint_segments. I noticed an enormous +> improvement increasing from the default to 40, but neglible +> improvement +> thereafter. Do you have a recommendation for a value? + +there's been a thread on -hackers recently about checkpoint issues.. +in a nut shell there isn't much to do. But I'd say give bizgres a +try if you're going to be continually loading huge amounts of data. + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 12:22:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C05C852BD5 + for ; + Tue, 26 Jul 2005 12:22:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39330-07 + for ; + Tue, 26 Jul 2005 15:22:36 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id 989F252AAB + for ; + Tue, 26 Jul 2005 12:22:35 -0300 (ADT) +Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) + by yertle.kcilink.com (Postfix) with ESMTP id D2E1BB80C; + Tue, 26 Jul 2005 11:22:33 -0400 (EDT) +In-Reply-To: <8446.1121799660@sss.pgh.pa.us> +References: <1efd553a05071910427b290203@mail.gmail.com> + <42DD3D55.9020508@commandprompt.com> + <1efd553a050719112126b8d981@mail.gmail.com> + <8446.1121799660@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v733) +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-4-202747623; + protocol="application/pkcs7-signature" +Message-Id: +Cc: pgsql-performance@postgresql.org +From: Vivek Khera +Subject: Re: Looking for tips +Date: Tue, 26 Jul 2005 11:22:31 -0400 +To: Tom Lane +X-Mailer: Apple Mail (2.733) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.021 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/386 +X-Sequence-Number: 13627 + + +--Apple-Mail-4-202747623 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + delsp=yes; + format=flowed + + +On Jul 19, 2005, at 3:01 PM, Tom Lane wrote: + +> You could possibly get some improvement if you can re-use prepared +> plans +> for the queries; but this will require some fooling with the client +> code +> (I'm not sure if DBD::Pg even has support for it at all). +> + +DBD::Pg 1.40+ by default uses server-side prepared statements when +you do $dbh->prepare() against an 8.x database server. + +Vivek Khera, Ph.D. ++1-301-869-4449 x806 + + + +--Apple-Mail-4-202747623 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w +ggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0 +ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcx +KDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0 +ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxA +dGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTlaMGIxCzAJBgNVBAYTAlpB +MSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUg +UGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA +xKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6YfK/Uc4B1OVQCjDXAmNaLIkVcI7d +yfArhVqqP3FWy688Cwfn8R+RNiQqE88r1fOCdz0Dviv+uxg+B79AgAJk16emu59l0cUqVIUPS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4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJz +b25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMOah8wDQYJKoZIhvcNAQEBBQAEggEAfauwaZUZzZiK +nvKzrvVLVho7FCvMl3TSs4u0uBhVK4zP/ZxsIwyS/ecYdD0QFxMw+4ftawmNmu/0jsjhxDzyhcjz +DgcEOCVy9FsbCurvaeYDWXj+FbTR9VMzYPk39rHZ3YmXb6ZqXJHVkQ8Tg/N6TU23EZCjc6iSqZXT +NRZXanaWS7Rb9awwG0VUow1wDg3uy4z1OP4onaTmOGI5EFhKzD4XcQ8U//Jn0pC3HIE+4+yLVJSB +IMiV437bMzGrYsjxBKZUnyvNMr0z3py5VfLbqNdj+c6BK9mArNW59WPNcS7YBuUQQv3UiQbe0kpC +DBnJQhRp1Izuf7r4+H97kL8zvgAAAAAAAA== + +--Apple-Mail-4-202747623-- + +From pgsql-performance-owner@postgresql.org Tue Jul 26 13:34:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 486B752E65 + for ; + Tue, 26 Jul 2005 13:34:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76212-05 + for ; + Tue, 26 Jul 2005 16:34:47 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id CAC3352C76 + for ; + Tue, 26 Jul 2005 13:34:45 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050726163441m9200g48ije>; Tue, 26 Jul 2005 16:34:41 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 4093C5600C; Tue, 26 Jul 2005 11:34:41 -0500 (CDT) +Received: from [192.168.1.11] (liliana.arbash-meinel.com [192.168.1.11]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 29FDB55FB5 + for ; + Tue, 26 Jul 2005 11:34:36 -0500 (CDT) +Message-ID: <42E6661D.3060304@arbash-meinel.com> +Date: Tue, 26 Jul 2005 11:34:37 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Postgresql Performance +Subject: Cheap RAM disk? +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig6935037441687B1F4F5B8D62" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/387 +X-Sequence-Number: 13628 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig6935037441687B1F4F5B8D62 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit + +I saw a review of a relatively inexpensive RAM disk over at +anandtech.com, the Gigabyte i-RAM +http://www.anandtech.com/storage/showdoc.aspx?i=2480 + +Basically, it is a PCI card, which takes standard DDR RAM, and has a +SATA port on it, so that to the system, it looks like a normal SATA drive. + +The card costs about $100-150, and you fill it with your own ram, so for +a 4GB (max size) disk, it costs around $500. Looking for solid state +storage devices, the cheapest I found was around $5k for 2GB. + +Gigabyte claims that the battery backup can last up to 16h, which seems +decent, if not really long (the $5k solution has a built-in harddrive so +that if the power goes out, it uses the battery power to copy the +ramdisk onto the harddrive for more permanent storage). + +Anyway, would something like this be reasonable as a drive for storing +pg_xlog? With 4GB you could have as many as 256 checkpoint segments. + +I'm a little leary as it is definitely a version 1.0 product (it is +still using an FPGA as the controller, so they were obviously pushing to +get the card into production). + +But it seems like this might be a decent way to improve insert +performance, without setting fsync=false. + +Probably it should see some serious testing (as in power spikes/pulled +plugs, etc). I know the article made some claim that if you actually +pull out the card it goes into "high consumption mode" which is somehow +greater than if you leave it in the slot with the power off. Which to me +seems like a lot of bull, and really means the 16h is only under +best-case circumstances. But even 1-2h is sufficient to handle a simple +power outage. + +And if you had a UPS with detection of power failure, you could always +sync the ramdisk to a local partition before the power goes out. Though +you could do that with a normal in-memory ramdisk (tmpfs) without having +to buy the card. Though it does give you up-to an extra 4GB of ram, for +machines which have already maxed out their slots. + +Anyway, I thought I would mention it to the list, to see if anyone else +has heard of it, or has any thoughts on the matter. I'm sure there are +some people who are using more expensive ram disks, maybe they have some +ideas about what this device is missing. (other than costing about +1/10th the price) + +John +=:-> + + +--------------enig6935037441687B1F4F5B8D62 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC5mYdJdeBCYSNAAMRAiS/AJ4oTdCEuFAKvdZg9ndBJRbucCqk7ACgszi/ +bWcE7rGEDR8YAleWF+GYnSI= +=Ef6t +-----END PGP SIGNATURE----- + +--------------enig6935037441687B1F4F5B8D62-- + +From pgsql-performance-owner@postgresql.org Tue Jul 26 13:49:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C23F252AAB + for ; + Tue, 26 Jul 2005 13:49:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 86783-01 + for ; + Tue, 26 Jul 2005 16:49:20 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 1640152E8B + for ; + Tue, 26 Jul 2005 13:49:18 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id 8AEB4644158 + for ; + Tue, 26 Jul 2005 10:48:51 -0600 (MDT) +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 28894-10 for ; + Tue, 26 Jul 2005 10:48:49 -0600 (MDT) +Received: from [192.168.1.12] (c-24-9-24-35.hsd1.co.comcast.net [24.9.24.35]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id 90BDA644121 + for ; + Tue, 26 Jul 2005 10:48:49 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +Content-Transfer-Encoding: 7bit +Message-Id: +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +To: pgsql-performance@postgresql.org +From: Dan Harris +Subject: faster INSERT with possible pre-existing row? +Date: Tue, 26 Jul 2005 10:50:14 -0600 +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/388 +X-Sequence-Number: 13629 + +I am working on a process that will be inserting tens of million rows +and need this to be as quick as possible. + +The catch is that for each row I could potentially insert, I need to +look and see if the relationship is already there to prevent +multiple entries. Currently I am doing a SELECT before doing the +INSERT, but I recognize the speed penalty in doing to operations. I +wonder if there is some way I can say "insert this record, only if it +doesn't exist already". To see if it exists, I would need to compare +3 fields instead of just enforcing a primary key. + +Even if this could be a small increase per record, even a few percent +faster compounded over the whole load could be a significant reduction. + +Thanks for any ideas you might have. + +-Dan + +From pgsql-performance-owner@postgresql.org Tue Jul 26 14:04:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B706752E6A + for ; + Tue, 26 Jul 2005 14:04:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89785-06 + for ; + Tue, 26 Jul 2005 17:04:05 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id AA24852C9E + for ; + Tue, 26 Jul 2005 14:04:04 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id DCB2B30B42; Tue, 26 Jul 2005 19:11:18 +0200 (MET DST) +From: Chris Browne +X-Newsgroups: pgsql.performance +Subject: Re: Cheap RAM disk? +Date: Tue, 26 Jul 2005 12:51:14 -0400 +Organization: cbbrowne Computing Inc +Lines: 64 +Message-ID: <60u0ih1pfh.fsf@dba2.int.libertyrms.com> +References: <42E6661D.3060304@arbash-meinel.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (Jumbo Shrimp, linux) +Cancel-Lock: sha1:9/1Xq5tnQ92R1zfjK80854jEktA= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.124 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/389 +X-Sequence-Number: 13630 + +john@arbash-meinel.com (John A Meinel) writes: +> I saw a review of a relatively inexpensive RAM disk over at +> anandtech.com, the Gigabyte i-RAM +> http://www.anandtech.com/storage/showdoc.aspx?i=2480 + +And the review shows that it's not *all* that valuable for many of the +cases they looked at. + +> Basically, it is a PCI card, which takes standard DDR RAM, and has a +> SATA port on it, so that to the system, it looks like a normal SATA +> drive. +> +> The card costs about $100-150, and you fill it with your own ram, so +> for a 4GB (max size) disk, it costs around $500. Looking for solid +> state storage devices, the cheapest I found was around $5k for 2GB. +> +> Gigabyte claims that the battery backup can last up to 16h, which +> seems decent, if not really long (the $5k solution has a built-in +> harddrive so that if the power goes out, it uses the battery power to +> copy the ramdisk onto the harddrive for more permanent storage). +> +> Anyway, would something like this be reasonable as a drive for storing +> pg_xlog? With 4GB you could have as many as 256 checkpoint segments. +> +> I'm a little leary as it is definitely a version 1.0 product (it is +> still using an FPGA as the controller, so they were obviously pushing +> to get the card into production). + +What disappoints me is that nobody has tried the CF/RAM answer; rather +than putting a hard drive on the board, you put on some form of flash +device (CompactFlash or such), where if power fails, it pushes data +onto the CF. That ought to be cheaper (both in terms of hardware cost +and power consumption) than using a hard disk. + +> But it seems like this might be a decent way to improve insert +> performance, without setting fsync=false. + +That's the case which might prove Ludicrously Quicker than any of the +sample cases in the review. + +> Probably it should see some serious testing (as in power spikes/pulled +> plugs, etc). I know the article made some claim that if you actually +> pull out the card it goes into "high consumption mode" which is +> somehow greater than if you leave it in the slot with the power +> off. Which to me seems like a lot of bull, and really means the 16h is +> only under best-case circumstances. But even 1-2h is sufficient to +> handle a simple power outage. + +Certainly. + +> Anyway, I thought I would mention it to the list, to see if anyone +> else has heard of it, or has any thoughts on the matter. I'm sure +> there are some people who are using more expensive ram disks, maybe +> they have some ideas about what this device is missing. (other than +> costing about 1/10th the price) + +Well, if it hits a "2.0" version, it may get interesting... +-- +(format nil "~S@~S" "cbbrowne" "acm.org") +http://www.ntlug.org/~cbbrowne/sap.html +Rules of the Evil Overlord #78. "I will not tell my Legions of Terror +"And he must be taken alive!" The command will be: ``And try to take +him alive if it is reasonably practical.''" + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 14:20:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 71EAC52E88 + for ; + Tue, 26 Jul 2005 14:20:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92700-06 + for ; + Tue, 26 Jul 2005 17:20:26 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id B112E52EA2 + for ; + Tue, 26 Jul 2005 14:20:24 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050726172024m9200g48k4e>; Tue, 26 Jul 2005 17:20:24 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 4176156011; Tue, 26 Jul 2005 11:56:26 -0500 (CDT) +Received: from [192.168.1.11] (liliana.arbash-meinel.com [192.168.1.11]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 2307E55FB5; + Tue, 26 Jul 2005 11:56:15 -0500 (CDT) +Message-ID: <42E66B30.3030108@arbash-meinel.com> +Date: Tue, 26 Jul 2005 11:56:16 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: faster INSERT with possible pre-existing row? +References: +In-Reply-To: +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig9C21B405ABDA157CADDE32ED" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/390 +X-Sequence-Number: 13631 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig9C21B405ABDA157CADDE32ED +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Dan Harris wrote: +> I am working on a process that will be inserting tens of million rows +> and need this to be as quick as possible. +> +> The catch is that for each row I could potentially insert, I need to +> look and see if the relationship is already there to prevent multiple +> entries. Currently I am doing a SELECT before doing the INSERT, but I +> recognize the speed penalty in doing to operations. I wonder if there +> is some way I can say "insert this record, only if it doesn't exist +> already". To see if it exists, I would need to compare 3 fields +> instead of just enforcing a primary key. +> +> Even if this could be a small increase per record, even a few percent +> faster compounded over the whole load could be a significant reduction. +> +> Thanks for any ideas you might have. +> +> -Dan +> + +You could insert all of your data into a temporary table, and then do: + +INSERT INTO final_table SELECT * FROM temp_table WHERE NOT EXISTS +(SELECT info FROM final_table WHERE id=id, path=path, y=y); + +Or you could load it into the temporary table, and then: +DELETE FROM temp_table WHERE EXISTS (SELECT FROM final_table WHERE id...); + +And then do a plain INSERT INTO. + +I can't say what the specific performance increases would be, but +temp_table could certainly be an actual TEMP table (meaning it only +exists during the connection), and you could easily do a COPY into that +table to load it up quickly, without having to check any constraints. + +Just a thought, +John +=:-> + + +--------------enig9C21B405ABDA157CADDE32ED +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC5mswJdeBCYSNAAMRAupDAKCrP6dp0q0HGvri2TlUZfeg/zZENwCcDUoS +OuTezkceW29aUAbY/2rAe9k= +=21Zo +-----END PGP SIGNATURE----- + +--------------enig9C21B405ABDA157CADDE32ED-- + +From pgsql-performance-owner@postgresql.org Tue Jul 26 14:43:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CFFDC52EB4 + for ; + Tue, 26 Jul 2005 14:43:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95343-10 + for ; + Tue, 26 Jul 2005 17:43:09 +0000 (GMT) +Received: from gghcwest.com (adsl-71-128-90-172.dsl.pltn13.pacbell.net + [71.128.90.172]) + by svr1.postgresql.org (Postfix) with ESMTP id 1D32652CB6 + for ; + Tue, 26 Jul 2005 14:43:08 -0300 (ADT) +Received: from toonses.gghcwest.com (toonses.gghcwest.com [192.168.168.115]) + by gghcwest.com (8.12.10/8.12.9) with ESMTP id j6QHgTmd017672; + Tue, 26 Jul 2005 10:42:30 -0700 +Received: from jwb by toonses.gghcwest.com with local (Exim 4.50) + id 1DxTRc-0003KL-JI; Tue, 26 Jul 2005 10:42:20 -0700 +Subject: Re: Cheap RAM disk? +From: "Jeffrey W. Baker" +To: John A Meinel +Cc: Postgresql Performance +In-Reply-To: <42E6661D.3060304@arbash-meinel.com> +References: <42E6661D.3060304@arbash-meinel.com> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Date: Tue, 26 Jul 2005 10:42:19 -0700 +Message-Id: <1122399740.12728.1.camel@toonses.gghcwest.com> +Mime-Version: 1.0 +X-Mailer: Evolution 2.3.5.1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200507/391 +X-Sequence-Number: 13632 + +On Tue, 2005-07-26 at 11:34 -0500, John A Meinel wrote: +> I saw a review of a relatively inexpensive RAM disk over at +> anandtech.com, the Gigabyte i-RAM +> http://www.anandtech.com/storage/showdoc.aspx?i=2480 +> +> Basically, it is a PCI card, which takes standard DDR RAM, and has a +> SATA port on it, so that to the system, it looks like a normal SATA drive. +> +> The card costs about $100-150, and you fill it with your own ram, so for +> a 4GB (max size) disk, it costs around $500. Looking for solid state +> storage devices, the cheapest I found was around $5k for 2GB. +> +> Gigabyte claims that the battery backup can last up to 16h, which seems +> decent, if not really long (the $5k solution has a built-in harddrive so +> that if the power goes out, it uses the battery power to copy the +> ramdisk onto the harddrive for more permanent storage). +> +> Anyway, would something like this be reasonable as a drive for storing +> pg_xlog? With 4GB you could have as many as 256 checkpoint segments. + +I haven't tried this product, but the microbenchmarks seem truly slow. +I think you would get a similar benefit by simply sticking a 1GB or 2GB +DIMM -- battery-backed, of course -- in your RAID controller. + +-jwb + +From pgsql-performance-owner@postgresql.org Tue Jul 26 14:49:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 870FC52CB6 + for ; + Tue, 26 Jul 2005 14:49:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97517-09 + for ; + Tue, 26 Jul 2005 17:49:06 +0000 (GMT) +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by svr1.postgresql.org (Postfix) with ESMTP id 3AF7152E65 + for ; + Tue, 26 Jul 2005 14:49:05 -0300 (ADT) +Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) + by yertle.kcilink.com (Postfix) with ESMTP id 1FEF3B80C + for ; + Tue, 26 Jul 2005 13:49:06 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v733) +In-Reply-To: <42E6661D.3060304@arbash-meinel.com> +References: <42E6661D.3060304@arbash-meinel.com> +X-Gpgmail-State: !signed +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-7-211540927; + protocol="application/pkcs7-signature" +Message-Id: <37F30C1F-1EEB-4705-B074-9E4469A1CBC6@khera.org> +From: Vivek Khera +Subject: Re: Cheap RAM disk? +Date: Tue, 26 Jul 2005 13:49:05 -0400 +To: Postgresql Performance +X-Mailer: Apple Mail (2.733) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.02 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/392 +X-Sequence-Number: 13633 + + +--Apple-Mail-7-211540927 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + delsp=yes; + format=flowed + + +On Jul 26, 2005, at 12:34 PM, John A Meinel wrote: + +> Basically, it is a PCI card, which takes standard DDR RAM, and has +> a SATA port on it, so that to the system, it looks like a normal +> SATA drive. +> +> The card costs about $100-150, and you fill it with your own ram, +> so for a 4GB (max size) disk, it costs around $500. Looking for +> solid state storage devices, the cheapest I found was around $5k +> for 2GB. +> + +gotta love /. don't ya? + +This card doesn't accept ECC RAM therefore it is nothing more than a +toy. I wouldn't trust it as far as I could throw it. + +There are other vendors of SSD's out there. Some even have *real* +power fail strategies such as dumping to a physical disk. These are +not cheap, but you gets what ya pays for... + +Vivek Khera, Ph.D. ++1-301-869-4449 x806 + + + +--Apple-Mail-7-211540927 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w +ggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0 +ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcx +KDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0 +ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxA +dGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTlaMGIxCzAJBgNVBAYTAlpB +MSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUg +UGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA +xKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6YfK/Uc4B1OVQCjDXAmNaLIkVcI7d +yfArhVqqP3FWy688Cwfn8R+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BgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJz +b25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMOah8wDQYJKoZIhvcNAQEBBQAEggEAr2H8GOSL5I5D +QNozxdVqXxGqqRjGvXLD+yKkXIzgbTNiG8W0Bwiu+T+MOatLLQsDfXAq4QQQUuqT24HKebLQ++Qz +0UV9v9mHEfQMMsUrBrNYBfCt2Kgdr2YU9xGVIairvCv2pTH4m0haFWrokzg2FX/sH45WDMIe7EYS +6Tb09wt8CSQpRodi8ROiACjwRn6imSLyrnMWkeG2K9AG3HFXuN0osv9/CZbrx0W15pI+vWTOTywg +6RWnw7vJAjd5CPSla5hQWoN9s3r6LEpT/iasOwa/k+apw2lPmRQPfNONpcjZHJN6GkvI9+u6InbP +y1delMuZ20xdrYYk2v5xDFDxPwAAAAAAAA== + +--Apple-Mail-7-211540927-- + +From pgsql-performance-owner@postgresql.org Tue Jul 26 15:17:01 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 14FB852C24 + for ; + Tue, 26 Jul 2005 15:16:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 05932-05 + for ; + Tue, 26 Jul 2005 18:16:57 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id E6E9E52C3A + for ; + Tue, 26 Jul 2005 15:16:56 -0300 (ADT) +Received: (qmail 27005 invoked from network); 26 Jul 2005 20:16:59 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 26 Jul 2005 20:16:59 +0200 +To: "John A Meinel" , + "Postgresql Performance" +Subject: Re: Cheap RAM disk? +References: <42E6661D.3060304@arbash-meinel.com> +Message-ID: +Date: Tue, 26 Jul 2005 20:16:59 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <42E6661D.3060304@arbash-meinel.com> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/393 +X-Sequence-Number: 13634 + + +> I'm a little leary as it is definitely a version 1.0 product (it is +> still using an FPGA as the controller, so they were obviously pushing to +> get the card into production). + + Not necessarily. FPGA's have become a sensible choice now. My RME studio +soundcard uses a big FPGA. + + The performance in the test doesn't look that good, though, but don't +forget it was run under windows. For instance they get 77s to copy the +Firefox source tree on their Athlon 64/raptor ; my Duron / 7200rpm ide +drive does it in 30 seconds, but not with windows of course. + + However it doesnt' use ECC so... That's a pity, because they could have +implemented ECC in "software" inside the chip, and have the benefits of +error correction with normal, cheap RAM. + + Well; wait and see... + +From pgsql-performance-owner@postgresql.org Tue Jul 26 15:23:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9A9B452AE5 + for ; + Tue, 26 Jul 2005 15:23:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07828-04 + for ; + Tue, 26 Jul 2005 18:23:31 +0000 (GMT) +Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) + by svr1.postgresql.org (Postfix) with ESMTP id 12E55529E1 + for ; + Tue, 26 Jul 2005 15:23:30 -0300 (ADT) +Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D4)); Tue, 26 Jul 2005 14:23:24 -0400 +X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 26 Jul + 2005 14:23:23 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Tue, 26 Jul + 2005 14:23:22 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Tue, 26 Jul 2005 11:23:23 -0700 +Subject: Re: Cheap RAM disk? +From: "Luke Lonergan" +To: "John A Meinel" , + "Postgresql Performance" +Message-ID: +In-Reply-To: <42E6661D.3060304@arbash-meinel.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 26 Jul 2005 18:23:23.0642 (UTC) + FILETIME=[1BAD15A0:01C5920F] +X-WSS-ID: 6EF8A0112VG209975-03-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, hits=1.578 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/394 +X-Sequence-Number: 13635 + +Yup - interesting and very niche product - it seems like it's only obvious +application is for the Postgresql WAL problem :-) + +The real differentiator is the battery backup part. Otherwise, the +filesystem caching is more effective, so put the RAM on the motherboard. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 15:28:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 16D2F52C37 + for ; + Tue, 26 Jul 2005 15:28:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08000-04 + for ; + Tue, 26 Jul 2005 18:28:08 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id A7F2B52BDC + for ; + Tue, 26 Jul 2005 15:28:06 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050726182807m9200g4722e>; Tue, 26 Jul 2005 18:28:07 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 3D8F45600C; Tue, 26 Jul 2005 13:28:07 -0500 (CDT) +Received: from [192.168.1.11] (liliana.arbash-meinel.com [192.168.1.11]) + by juju.arbash-meinel.com (Postfix) with ESMTP id C1BFC55FB5; + Tue, 26 Jul 2005 13:28:02 -0500 (CDT) +Message-ID: <42E680B3.6020303@arbash-meinel.com> +Date: Tue, 26 Jul 2005 13:28:03 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Luke Lonergan +Cc: Postgresql Performance +Subject: Re: Cheap RAM disk? +References: +In-Reply-To: +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig20AADE360217A01B16CEDF6E" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.044 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/395 +X-Sequence-Number: 13636 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig20AADE360217A01B16CEDF6E +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Luke Lonergan wrote: +> Yup - interesting and very niche product - it seems like it's only obvious +> application is for the Postgresql WAL problem :-) + +Well, you could do it for any journaled system (XFS, JFS, ext3, reiserfs). + +But yes, it seems specifically designed for a battery backed journal. +Though the article reviews it for very different purposes. + +Though it was a Windows review, and I don't know of any way to make NTFS +use a separate device for a journal. (Though I expect it is possible +somehow). + +John +=:-> + + +> +> The real differentiator is the battery backup part. Otherwise, the +> filesystem caching is more effective, so put the RAM on the motherboard. +> +> - Luke +> + + + +--------------enig20AADE360217A01B16CEDF6E +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC5oC0JdeBCYSNAAMRAlkaAKDNKALSqDb0MRL9daxin3P/bDxhLgCgwJ0S +zqcW3/c5LLJCNi6cvF11nIg= +=OqSJ +-----END PGP SIGNATURE----- + +--------------enig20AADE360217A01B16CEDF6E-- + +From pgsql-performance-owner@postgresql.org Tue Jul 26 16:27:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7842152CA1 + for ; + Tue, 26 Jul 2005 16:27:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57959-03 + for ; + Tue, 26 Jul 2005 19:27:16 +0000 (GMT) +Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) + by svr1.postgresql.org (Postfix) with ESMTP id 341B152C87 + for ; + Tue, 26 Jul 2005 16:27:15 -0300 (ADT) +Received: from osgiliath.mathom.us ([70.108.53.154]) + by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix + 0.04 (built Dec 24 2004)) with ESMTPA id + <0IK900KOO21CJ9CH@vms042.mailsrvcs.net> for + pgsql-performance@postgresql.org; Tue, 26 Jul 2005 14:27:13 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id 292246247A1 for + ; + Tue, 26 Jul 2005 14:33:43 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 03245-01-16 for ; Tue, + 26 Jul 2005 14:33:43 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id 10D43623284; Tue, 26 Jul 2005 14:33:43 -0400 (EDT) +Date: Tue, 26 Jul 2005 14:33:43 -0400 +From: Michael Stone +Subject: Re: Cheap RAM disk? +In-reply-to: +To: pgsql-performance@postgresql.org +Mail-Followup-To: pgsql-performance@postgresql.org +Message-id: <20050726183343.GZ19080@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us +References: <42E6661D.3060304@arbash-meinel.com> + +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/401 +X-Sequence-Number: 13642 + +On Tue, Jul 26, 2005 at 11:23:23AM -0700, Luke Lonergan wrote: +>Yup - interesting and very niche product - it seems like it's only obvious +>application is for the Postgresql WAL problem :-) + +On the contrary--it's not obvious that it is an ideal fit for a WAL. A +ram disk like this is optimized for highly random access applications. +The WAL is a single sequential writer. If you're in the kind of market +that needs a really high performance WAL you'd be much better served by +putting a big NVRAM cache in front of a fast disk array than by buying a +toy like this. + +Mike Stone + +From pgsql-performance-owner@postgresql.org Tue Jul 26 15:47:04 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3F3AC52940 + for ; + Tue, 26 Jul 2005 15:47:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13410-09 + for ; + Tue, 26 Jul 2005 18:46:57 +0000 (GMT) +Received: from mail.Mi8.com (mail.mi8.com [63.240.6.50]) + by svr1.postgresql.org (Postfix) with ESMTP id CD9D352C90 + for ; + Tue, 26 Jul 2005 15:46:54 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- GW05 Welcome + to Mi8 Corporation www.Mi8.com); Tue, 26 Jul 2005 14:46:33 -0400 +X-Server-Uuid: E0C866E6-C6CD-48B5-AE61-E57E73CF3CC7 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 26 Jul + 2005 14:46:34 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Tue, 26 Jul + 2005 14:46:33 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Tue, 26 Jul 2005 11:46:33 -0700 +Subject: Re: faster INSERT with possible pre-existing row? +From: "Luke Lonergan" +To: "John A Meinel" , + "Dan Harris" +Cc: pgsql-performance@postgresql.org, + "bizgres-general" +Message-ID: +In-Reply-To: <42E66B30.3030108@arbash-meinel.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 26 Jul 2005 18:46:34.0256 (UTC) + FILETIME=[588BF100:01C59212] +X-WSS-ID: 6EF85A831M813479194-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, hits=1.578 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/396 +X-Sequence-Number: 13637 + +John, + +On 7/26/05 9:56 AM, "John A Meinel" wrote: + +> You could insert all of your data into a temporary table, and then do: +> +> INSERT INTO final_table SELECT * FROM temp_table WHERE NOT EXISTS +> (SELECT info FROM final_table WHERE id=id, path=path, y=y); +> +> Or you could load it into the temporary table, and then: +> DELETE FROM temp_table WHERE EXISTS (SELECT FROM final_table WHERE id...); +> +> And then do a plain INSERT INTO. +> +> I can't say what the specific performance increases would be, but +> temp_table could certainly be an actual TEMP table (meaning it only +> exists during the connection), and you could easily do a COPY into that +> table to load it up quickly, without having to check any constraints. + +Yah - that's a typical approach, and it would be excellent if the COPY +bypassed WAL for the temp table load. This is something we discussed in +bizgres development a while back. I think we should do this for sure - +would nearly double the temp table load rate, and the subsequent temp table +delete *should* be fast enough (?) Any performance tests you've done on +that delete/subselect operation? + +- Luke + + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 16:02:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A630452C87 + for ; + Tue, 26 Jul 2005 16:02:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 33563-02 + for ; + Tue, 26 Jul 2005 19:02:15 +0000 (GMT) +Received: from smtp-gw-cl-d.dmv.com (smtp-gw-cl-d.dmv.com [216.240.97.42]) + by svr1.postgresql.org (Postfix) with ESMTP id BE67252C88 + for ; + Tue, 26 Jul 2005 16:02:12 -0300 (ADT) +Received: from lanshark.dmv.com (lanshark.dmv.com [216.240.97.46]) + by smtp-gw-cl-d.dmv.com (8.12.10/8.12.10) with ESMTP id j6QJ2ACf065855; + Tue, 26 Jul 2005 15:02:10 -0400 (EDT) (envelope-from sven@dmv.com) +Subject: Re: faster INSERT with possible pre-existing row? +From: Sven Willenberger +To: Dan Harris +Cc: pgsql-performance@postgresql.org +In-Reply-To: +References: +Content-Type: text/plain +Date: Tue, 26 Jul 2005 15:03:17 -0400 +Message-Id: <1122404597.1605.50.camel@lanshark.dmv.com> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 +Content-Transfer-Encoding: 7bit +X-Scanned-By: MIMEDefang 2.48 on 216.240.97.42 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.329 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_WHOIS +X-Spam-Level: +X-Archive-Number: 200507/397 +X-Sequence-Number: 13638 + +On Tue, 2005-07-26 at 10:50 -0600, Dan Harris wrote: +> I am working on a process that will be inserting tens of million rows +> and need this to be as quick as possible. +> +> The catch is that for each row I could potentially insert, I need to +> look and see if the relationship is already there to prevent +> multiple entries. Currently I am doing a SELECT before doing the +> INSERT, but I recognize the speed penalty in doing to operations. I +> wonder if there is some way I can say "insert this record, only if it +> doesn't exist already". To see if it exists, I would need to compare +> 3 fields instead of just enforcing a primary key. +> +> Even if this could be a small increase per record, even a few percent +> faster compounded over the whole load could be a significant reduction. +> +> Thanks for any ideas you might have. +> + +Perhaps a trigger: + +CREATE FUNCTION verify_unique() RETURNS TRIGGER AS $func$ +BEGIN + PERFORM a,b,c FROM table1 WHERE a = NEW.a and b = NEW.b and c = NEW.c; + IF FOUND THEN + RETURN NULL; + END IF; + RETURN NEW; +END; +$func$ LANGUAGE plpgsql STABLE; + +CREATE TRIGGER verify_unique BEFORE INSERT ON table1 FOR EACH ROW +EXECUTE PROCEDURE verify_unique(); + +Triggers are fired on COPY commands and if table1 is able to be cached +and you have an index on table1(a,b,c) the results should be fairly +decent. I would be interested in seeing the difference in timing between +this approach and the temp table approach. + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 16:10:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C522252C62 + for ; + Tue, 26 Jul 2005 16:10:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34050-08 + for ; + Tue, 26 Jul 2005 19:10:11 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.199]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DA3252AAB + for ; + Tue, 26 Jul 2005 16:10:09 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i21so15167wra + for ; + Tue, 26 Jul 2005 12:10:11 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=lk0S0F4WVvCDkaZpyFc/JWM34Rji2UyoGA5eYne5Qw9lJHbrjAe2QhasvJhLVzAJjt8ZyCeBqmyBuINZh8jUh7TxLM1bxZrgIEpWqcPt6cQept5ndnjPEpWiRilrbIfxyGr/LkzMjENoYL3YcUQmOi+PUsyBpBDW2hP/pTZeO7k= +Received: by 10.54.116.17 with SMTP id o17mr36668wrc; + Tue, 26 Jul 2005 12:10:11 -0700 (PDT) +Received: by 10.54.86.15 with HTTP; Tue, 26 Jul 2005 12:10:11 -0700 (PDT) +Message-ID: <33c6269f0507261210400dff27@mail.gmail.com> +Date: Tue, 26 Jul 2005 15:10:11 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: PFC +Subject: Re: Cheap RAM disk? +Cc: John A Meinel , + 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: <42E6661D.3060304@arbash-meinel.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.107 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/398 +X-Sequence-Number: 13639 + +Please see: + +http://www.newegg.com/Product/Product.asp?Item=3DN82E16820145309 +and +http://www.newegg.com/Product/Product.asp?Item=3DN82E16820145416 + +The price of Reg ECC is not significantly higher than regular ram at +this point. Plus if you go with super fast 2-2-2-6 then it's actualy +more than good ol 2.5 Reg ECC. + +Alex Turner +NetEconomist + +On 7/26/05, PFC wrote: +>=20 +> > I'm a little leary as it is definitely a version 1.0 product (it is +> > still using an FPGA as the controller, so they were obviously pushing t= +o +> > get the card into production). +>=20 +> Not necessarily. FPGA's have become a sensible choice now. My RME= + studio +> soundcard uses a big FPGA. +>=20 +> The performance in the test doesn't look that good, though, but d= +on't +> forget it was run under windows. For instance they get 77s to copy the +> Firefox source tree on their Athlon 64/raptor ; my Duron / 7200rpm ide +> drive does it in 30 seconds, but not with windows of course. +>=20 +> However it doesnt' use ECC so... That's a pity, because they coul= +d have +> implemented ECC in "software" inside the chip, and have the benefits of +> error correction with normal, cheap RAM. +>=20 +> Well; wait and see... +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend +> + +From pgsql-performance-owner@postgresql.org Tue Jul 26 16:12:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 36B3252CAE + for ; + Tue, 26 Jul 2005 16:11:55 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 32814-10 + for ; + Tue, 26 Jul 2005 19:11:47 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) + by svr1.postgresql.org (Postfix) with ESMTP id 9DAFF52C8D + for ; + Tue, 26 Jul 2005 16:11:41 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id i21so15386wra + for ; + Tue, 26 Jul 2005 12:11:43 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=i0vJAm2Hw1eaDTX8YCd2ID81QhW+yt3qTgbg5MLVNlaxWHL1ncPToUoAW7co67gZEmasBWwfMqBrxWHXAD+RUn+tYvqxchh80Dxi3nmC2ACSD09tdM23uSoLueMeblAPTscE8p/X/OlJF+Ju5mAcxmMGNoKHmDMgIMbm/mctUzo= +Received: by 10.54.106.1 with SMTP id e1mr30604wrc; + Tue, 26 Jul 2005 12:11:43 -0700 (PDT) +Received: by 10.54.86.15 with HTTP; Tue, 26 Jul 2005 12:11:42 -0700 (PDT) +Message-ID: <33c6269f05072612113bd68434@mail.gmail.com> +Date: Tue, 26 Jul 2005 15:11:42 -0400 +From: Alex Turner +Reply-To: Alex Turner +To: John A Meinel +Subject: Re: Cheap RAM disk? +Cc: Postgresql Performance +In-Reply-To: <42E6661D.3060304@arbash-meinel.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <42E6661D.3060304@arbash-meinel.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.107 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/399 +X-Sequence-Number: 13640 + +Also seems pretty silly to put it on a regular SATA connection, when +all that can manage is 150MB/sec. If you made it connection directly +to 66/64-bit PCI then it could actualy _use_ the speed of the RAM, not +to mention PCI-X. + +Alex Turner +NetEconomist + +On 7/26/05, John A Meinel wrote: +> I saw a review of a relatively inexpensive RAM disk over at +> anandtech.com, the Gigabyte i-RAM +> http://www.anandtech.com/storage/showdoc.aspx?i=3D2480 +>=20 +> Basically, it is a PCI card, which takes standard DDR RAM, and has a +> SATA port on it, so that to the system, it looks like a normal SATA drive= +. +>=20 +> The card costs about $100-150, and you fill it with your own ram, so for +> a 4GB (max size) disk, it costs around $500. Looking for solid state +> storage devices, the cheapest I found was around $5k for 2GB. +>=20 +> Gigabyte claims that the battery backup can last up to 16h, which seems +> decent, if not really long (the $5k solution has a built-in harddrive so +> that if the power goes out, it uses the battery power to copy the +> ramdisk onto the harddrive for more permanent storage). +>=20 +> Anyway, would something like this be reasonable as a drive for storing +> pg_xlog? With 4GB you could have as many as 256 checkpoint segments. +>=20 +> I'm a little leary as it is definitely a version 1.0 product (it is +> still using an FPGA as the controller, so they were obviously pushing to +> get the card into production). +>=20 +> But it seems like this might be a decent way to improve insert +> performance, without setting fsync=3Dfalse. +>=20 +> Probably it should see some serious testing (as in power spikes/pulled +> plugs, etc). I know the article made some claim that if you actually +> pull out the card it goes into "high consumption mode" which is somehow +> greater than if you leave it in the slot with the power off. Which to me +> seems like a lot of bull, and really means the 16h is only under +> best-case circumstances. But even 1-2h is sufficient to handle a simple +> power outage. +>=20 +> And if you had a UPS with detection of power failure, you could always +> sync the ramdisk to a local partition before the power goes out. Though +> you could do that with a normal in-memory ramdisk (tmpfs) without having +> to buy the card. Though it does give you up-to an extra 4GB of ram, for +> machines which have already maxed out their slots. +>=20 +> Anyway, I thought I would mention it to the list, to see if anyone else +> has heard of it, or has any thoughts on the matter. I'm sure there are +> some people who are using more expensive ram disks, maybe they have some +> ideas about what this device is missing. (other than costing about +> 1/10th the price) +>=20 +> John +> =3D:-> +>=20 +>=20 +>=20 +> + +From pgsql-performance-owner@postgresql.org Tue Jul 26 16:15:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0E0CF52C62 + for ; + Tue, 26 Jul 2005 16:15:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 33869-09 + for ; + Tue, 26 Jul 2005 19:15:35 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id C8BC752C44 + for ; + Tue, 26 Jul 2005 16:15:31 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050726191532m9200g488fe>; Tue, 26 Jul 2005 19:15:32 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 98A8E5600C; Tue, 26 Jul 2005 14:15:32 -0500 (CDT) +Received: from [192.168.1.11] (liliana.arbash-meinel.com [192.168.1.11]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 7717555FB5; + Tue, 26 Jul 2005 14:15:26 -0500 (CDT) +Message-ID: <42E68BCF.8010600@arbash-meinel.com> +Date: Tue, 26 Jul 2005 14:15:27 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Alex Turner +Cc: Postgresql Performance +Subject: Re: Cheap RAM disk? +References: <42E6661D.3060304@arbash-meinel.com> + <33c6269f05072612113bd68434@mail.gmail.com> +In-Reply-To: <33c6269f05072612113bd68434@mail.gmail.com> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig546882E2A9D441DC56323519" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.044 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/400 +X-Sequence-Number: 13641 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig546882E2A9D441DC56323519 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Alex Turner wrote: +> Also seems pretty silly to put it on a regular SATA connection, when +> all that can manage is 150MB/sec. If you made it connection directly +> to 66/64-bit PCI then it could actualy _use_ the speed of the RAM, not +> to mention PCI-X. +> +> Alex Turner +> NetEconomist +> + +Well, the whole point is to have it look like a normal SATA drive, even +to the point that you can boot off of it, without having to load a +single driver. + +Now, you could offer that you could recreate a SATA controller on the +card, with a SATA bios, etc. And then you could get the increased speed, +and still have bootable functionality. + +But it is a version 1.0 of a product, and I'm sure they tried to make it +as cheap as possible (and within their own capabilities.) + +John +=:-> + + +--------------enig546882E2A9D441DC56323519 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC5ovPJdeBCYSNAAMRAuwrAKCuJzSoBX8ZbynBBIh1s64qdMLhiACfUzgq +/PRFbMYdJuEPWa2t+Uv7bpg= +=hxWU +-----END PGP SIGNATURE----- + +--------------enig546882E2A9D441DC56323519-- + +From pgsql-performance-owner@postgresql.org Tue Jul 26 16:30:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1C66352CBB + for ; + Tue, 26 Jul 2005 16:30:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44598-08 + for ; + Tue, 26 Jul 2005 19:30:09 +0000 (GMT) +Received: from mail.Mi8.com (mail.mi8.com [63.240.6.41]) + by svr1.postgresql.org (Postfix) with ESMTP id 9456552C70 + for ; + Tue, 26 Jul 2005 16:30:04 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- GW01 Welcome + to Mi8 Corporation www.Mi8.com); Tue, 26 Jul 2005 15:30:00 -0400 +X-Server-Uuid: F1A2E19A-84E4-48DD-8F48-B475613F58B2 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 26 Jul + 2005 15:30:00 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Tue, 26 Jul + 2005 15:30:00 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Tue, 26 Jul 2005 12:30:00 -0700 +Subject: Re: [Bizgres-general] Re: faster INSERT with possible +From: "Luke Lonergan" +To: "Hannu Krosing" +Cc: "John A Meinel" , + "Dan Harris" , + "bizgres-general" , + pgsql-performance@postgresql.org +Message-ID: +In-Reply-To: <1122404195.31930.4.camel@fuji.krosing.net> +MIME-Version: 1.0 +X-OriginalArrivalTime: 26 Jul 2005 19:30:00.0612 (UTC) + FILETIME=[6A0E4E40:01C59218] +X-WSS-ID: 6EF850B221S789033-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, hits=1.577 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/402 +X-Sequence-Number: 13643 + +Hannu, + +On 7/26/05 11:56 AM, "Hannu Krosing" wrote: + +> On T, 2005-07-26 at 11:46 -0700, Luke Lonergan wrote: +> +>> Yah - that's a typical approach, and it would be excellent if the COPY +>> bypassed WAL for the temp table load. +> +> Don't *all* operations on TEMP tables bypass WAL ? + +Good question - do they? We had discussed the bypass as an elective option, +or an automated one for special conditions (no index on table, empty table) +or both. I thought that temp tables was one of those special conditions. + +Well - now that I test it, it appears you are correct, temp table COPY +bypasses WAL - thanks for pointing it out! + +The following test is on a load of 200MB of table data from an ASCII file +with 1 text column of size 145MB. + +- Luke + +===================== TEST =========================== +dgtestdb=# create temporary table temp1 (a text); +CREATE TABLE +dgtestdb=# \timing +Timing is on. +dgtestdb=# \i copy.ctl +COPY +Time: 4549.212 ms +dgtestdb=# \i copy.ctl +COPY +Time: 3897.395 ms + +-- that's two tests, two loads of 200MB each, averaging 4.2 secs + +dgtestdb=# create table temp2 as select * from temp1; +SELECT +Time: 5914.803 ms + +-- a quick comparison to "CREATE TABLE AS SELECT", which bypasses WAL +-- on bizgres + +dgtestdb=# drop table temp1; +DROP TABLE +Time: 135.782 ms +dgtestdb=# drop table temp2; +DROP TABLE +Time: 3.707 ms +dgtestdb=# create table temp1 (a text); +CREATE TABLE +Time: 1.667 ms +dgtestdb=# \i copy.ctl +COPY +Time: 6034.274 ms +dgtestdb=# + +-- This was a non-temporary table COPY, showing the slower performance of 6 +secs. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 16:35:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C446452C87 + for ; + Tue, 26 Jul 2005 16:35:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61299-07 + for ; + Tue, 26 Jul 2005 19:35:19 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) + by svr1.postgresql.org (Postfix) with ESMTP id B6AAC52C73 + for ; + Tue, 26 Jul 2005 16:35:15 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 70so22791wra + for ; + Tue, 26 Jul 2005 12:35:17 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=ssbNqQ1ji0BelG+bDIAq+CRiOY0LmhOT5dkoZvSLcSOgzouX4t4HebnZsjXgcnnrPuHFrYGpvgf7xkrRL0o/qqcopQMjt1RN2xDb2ypu2PsP5nkJULFyKw0bEVKdcsjNNHeCAjqFp4N5AKEu5W3uY1663DnpCMUc5T8J97RX9BQ= +Received: by 10.54.24.49 with SMTP id 49mr49888wrx; + Tue, 26 Jul 2005 12:35:17 -0700 (PDT) +Received: by 10.54.22.15 with HTTP; Tue, 26 Jul 2005 12:35:16 -0700 (PDT) +Message-ID: +Date: Tue, 26 Jul 2005 14:35:17 -0500 +From: Matthew Nuzum +Reply-To: newz@bearfruit.org +To: Dan Harris +Subject: Re: faster INSERT with possible pre-existing row? +Cc: pgsql-performance@postgresql.org +In-Reply-To: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.144 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/404 +X-Sequence-Number: 13645 + +On 7/26/05, Dan Harris wrote: +> I am working on a process that will be inserting tens of million rows +> and need this to be as quick as possible. +>=20 +> The catch is that for each row I could potentially insert, I need to +> look and see if the relationship is already there to prevent +> multiple entries. Currently I am doing a SELECT before doing the +> INSERT, but I recognize the speed penalty in doing to operations. I +> wonder if there is some way I can say "insert this record, only if it +> doesn't exist already". To see if it exists, I would need to compare +> 3 fields instead of just enforcing a primary key. + +I struggled with this for a while. At first I tried stored procedures +and triggers, but it took very long (over 24 hours for my dataset). +After several iterations of rewritting it, first into C# then into +Python I got the whole process down to under 30 min. + +My scenario is this: +I want to normalize log data. For example, for the IP address in a log +entry, I need to look up the unique id of the IP address, or if the IP +address is new, insert it and then return the newly created entry. +Multiple processes use the data, but only one process, run daily, +actually changes it. Because this one process knows that the data is +static, it selects the tables into in-memory hash tables (C#) or +Dictionaries (Python) and then does the lookups there. It is *super* +fast, but it uses a *lot* of ram. ;-) + +To limit the ram, I wrote a version of the python code that uses gdbm +files instead of Dictionaries. This requires a newer version of Python +(to allow a gdbm db to work just like a dictionary) but makes life +easier in case someone is using my software on a lower end machine. +This doubled the time of the lookups from about 15 minutes to 30, +bringing the whole process to about 45 minutes. + +--=20 +Matthew Nuzum +www.bearfruit.org + +From pgsql-performance-owner@postgresql.org Tue Jul 26 16:35:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B94E152C78 + for ; + Tue, 26 Jul 2005 16:35:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51186-08 + for ; + Tue, 26 Jul 2005 19:35:21 +0000 (GMT) +Received: from smtp5.pop.com.br (smtp5.pop.com.br [200.175.8.39]) + by svr1.postgresql.org (Postfix) with ESMTP id 6026452C70 + for ; + Tue, 26 Jul 2005 16:35:18 -0300 (ADT) +Received: from smtp5.pop.com.br (localhost [127.0.0.1]) + by smtp5.pop.com.br (Postfix) with ESMTP id 8F1BA93928 + for ; + Tue, 26 Jul 2005 16:35:19 -0300 (BRT) +Received: from popmail5.pop.com.br (popmail5.pop.com.br [200.175.8.30]) + by smtp5.pop.com.br (Postfix) with SMTP id 808FE9379A + for ; + Tue, 26 Jul 2005 16:35:19 -0300 (BRT) +Received: from 200.101.246.47 (proxying for 192.168.69.6) + (POPmail authenticated user beto.neto) + by popmail5.pop.com.br with HTTP; + Tue, 26 Jul 2005 16:35:19 -0300 (EST) +Message-ID: <38776.200.101.246.47.1122406519.squirrel@popmail5.pop.com.br> +Date: Tue, 26 Jul 2005 16:35:19 -0300 (EST) +Subject: [IMPORTANT] - My application performance +From: "Roberto Germano Vieweg Neto" +To: pgsql-performance@postgresql.org +User-Agent: POPMail/1.4.2 +X-POPMail-client-ip: 200.101.246.47 +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable +X-DCC-POPInternet-Metrics: dcc 1259; Body=1 Fuz1=1 Fuz2=1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/403 +X-Sequence-Number: 13644 + +My application is using Firebird 1.5.2 + +I have at my database: +- 150 Doamins +- 318 tables +- 141 Views +- 365 Procedures +- 407 Triggers +- 75 generators +- 161 Exceptions +- 183 UDFs +- 1077 Indexes + +My question is: + +Postgre SQL will be more faster than Firebird? How much (in percent)? + +I need about 20% to 50% more performance at my application. +Can I get this migratin to postgresql ? + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 16:51:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 56F8952CAB + for ; + Tue, 26 Jul 2005 16:51:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67897-06 + for ; + Tue, 26 Jul 2005 19:51:21 +0000 (GMT) +Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) + by svr1.postgresql.org (Postfix) with ESMTP id 01DD852C78 + for ; + Tue, 26 Jul 2005 16:51:18 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP + id <20050726195115m9100613f7e>; Tue, 26 Jul 2005 19:51:19 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 2EB895600C; Tue, 26 Jul 2005 14:51:15 -0500 (CDT) +Received: from [192.168.1.11] (liliana.arbash-meinel.com [192.168.1.11]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 23A8655FB5; + Tue, 26 Jul 2005 14:51:10 -0500 (CDT) +Message-ID: <42E6942F.3070006@arbash-meinel.com> +Date: Tue, 26 Jul 2005 14:51:11 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: newz@bearfruit.org +Cc: Dan Harris , + pgsql-performance@postgresql.org +Subject: Re: faster INSERT with possible pre-existing row? +References: + +In-Reply-To: +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigE97DC7894F092B8718A89C85" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.044 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/405 +X-Sequence-Number: 13646 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigE97DC7894F092B8718A89C85 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Matthew Nuzum wrote: +> On 7/26/05, Dan Harris wrote: +> +>>I am working on a process that will be inserting tens of million rows +>>and need this to be as quick as possible. +>> +>>The catch is that for each row I could potentially insert, I need to +>>look and see if the relationship is already there to prevent +>>multiple entries. Currently I am doing a SELECT before doing the +>>INSERT, but I recognize the speed penalty in doing to operations. I +>>wonder if there is some way I can say "insert this record, only if it +>>doesn't exist already". To see if it exists, I would need to compare +>>3 fields instead of just enforcing a primary key. +> +> +> I struggled with this for a while. At first I tried stored procedures +> and triggers, but it took very long (over 24 hours for my dataset). +> After several iterations of rewritting it, first into C# then into +> Python I got the whole process down to under 30 min. +> +> My scenario is this: +> I want to normalize log data. For example, for the IP address in a log +> entry, I need to look up the unique id of the IP address, or if the IP +> address is new, insert it and then return the newly created entry. +> Multiple processes use the data, but only one process, run daily, +> actually changes it. Because this one process knows that the data is +> static, it selects the tables into in-memory hash tables (C#) or +> Dictionaries (Python) and then does the lookups there. It is *super* +> fast, but it uses a *lot* of ram. ;-) +> +> To limit the ram, I wrote a version of the python code that uses gdbm +> files instead of Dictionaries. This requires a newer version of Python +> (to allow a gdbm db to work just like a dictionary) but makes life +> easier in case someone is using my software on a lower end machine. +> This doubled the time of the lookups from about 15 minutes to 30, +> bringing the whole process to about 45 minutes. +> + +Did you ever try the temp table approach? You could: + +COPY all records into temp_table, with an empty row for ip_id +-- Get any entries which already exist +UPDATE temp_table SET ip_id = + (SELECT ip_id from ipaddress WHERE add=add) + WHERE EXISTS (SELECT ip_id FROM ipaddress WHERE add=add); +-- Create new entries +INSERT INTO ipaddress(add) SELECT add FROM temp_table + WHERE ip_id IS NULL; +-- Update the rest +UPDATE temp_table SET ip_id = + (SELECT ip_id from ipaddress WHERE add=add) + WHERE ip_id IS NULL AND + EXISTS (SELECT ip_id FROM ipaddress WHERE add=add); + +This would let the database do all of the updating work in bulk on it's +side, rather than you pulling all the data out and doing it locally. + +An alternative would be something like: + +CREATE TEMP TABLE new_ids (address text, ip_id int); +COPY all potentially new addresses into that table. +-- Delete all entries which already exist +DELETE FROM new_ids WHERE EXISTS + (SELECT ip_id FROM ipaddresses + WHERE add=new_ids.address); +-- Now create the new entries +INSERT INTO ipaddresses(add) SELECT address FROM new_ids; + +-- At this point you are guaranteed to have all addresses existing in +-- the database + +If you then insert your full data into the final table, only leave the +ip_id column as null. Then if you have a partial index where ip_id is +NULL, you could use the command: + +UPDATE final_table SET ip_id = + (SELECT ip_id FROM ipaddresses WHERE add=final_table.add) +WHERE ip_id IS NULL; + +You could also do this in a temporary table, before bulk inserting into +the final table. + +I don't know what you have tried, but I know that for Dan, he easily has + > 36M rows. So I don't think he wants to pull that locally and create a +in-memory hash just to insert 100 rows or so. + +Also, for your situation, if you do keep a local cache, you could +certainly save the cache between runs, and use a temp table to determine +what new ids you need to add to it. Then you wouldn't have to pull the +complete set each time. You just pull new values for entries you haven't +added yet. + +John +=:-> + +--------------enigE97DC7894F092B8718A89C85 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC5pQvJdeBCYSNAAMRAgo1AJ4ymsiIWbtLh85+pw1lBF2U23EdOACfUxlX +B+NHHBJyDb0k/VGl2/fVkpo= +=pXYP +-----END PGP SIGNATURE----- + +--------------enigE97DC7894F092B8718A89C85-- + +From pgsql-performance-owner@postgresql.org Tue Jul 26 17:02:52 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AB0E552940 + for ; + Tue, 26 Jul 2005 17:02:50 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70802-03 + for ; + Tue, 26 Jul 2005 20:02:41 +0000 (GMT) +Received: from dfw-gate2.raytheon.com (dfw-gate2.raytheon.com + [199.46.199.231]) + by svr1.postgresql.org (Postfix) with ESMTP id 8D82C52C73 + for ; + Tue, 26 Jul 2005 17:02:40 -0300 (ADT) +Received: from ds02c00.directory.ray.com (ds02c00.directory.ray.com + [147.25.138.118]) + by dfw-gate2.raytheon.com (8.12.10/8.12.10) with ESMTP id + j6QK2cPC006492 for ; + Tue, 26 Jul 2005 15:02:38 -0500 (CDT) +Received: from ds02c00 (localhost [127.0.0.1]) + by ds02c00.directory.ray.com (Switch-3.1.7/Switch-3.1.0) with ESMTP id + j6QK2Y6S013381 + for ; Tue, 26 Jul 2005 20:02:34 GMT +Received: from ds02c00.directory.ray.com with LMTP by ds02c00 + (2.0.6/sieved-2-0-build-559) + for ; Tue, 26 Jul 2005 20:02:33 +0000 +Received: from notesserver5.ftw.us.ray.com (notesserver5.ftw.us.ray.com + [151.168.145.35]) + by ds02c00.directory.ray.com (Switch-3.1.7/Switch-3.1.0) with ESMTP id + j6QK23Nh013087 sender Richard_D_Levine@raytheon.com for + ; Tue, 26 Jul 2005 20:02:03 GMT +In-Reply-To: <20050726183343.GZ19080@mathom.us> +Subject: Re: Cheap RAM disk? +To: pgsql-performance@postgresql.org +X-Mailer: Lotus Notes Release 6.5.2 June 01, 2004 +Message-ID: + +From: Richard_D_Levine@raytheon.com +Date: Tue, 26 Jul 2005 15:02:01 -0500 +X-MIMETrack: Serialize by Router on NotesServer5/HDC(Release 6.5.2|June 01, + 2004) at 07/26/2005 03:02:03 PM +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-SPAM: 0.00 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.207 tagged_above=0 required=5 tests=AWL, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200507/406 +X-Sequence-Number: 13647 + +> you'd be much better served by +> putting a big NVRAM cache in front of a fast disk array + +I agree with the point below, but I think price was the issue of the +original discussion. That said, it seems that a single high speed spindle +would give this a run for its money in both price and performance, and for +the same reasons Mike points out. Maybe a SCSI 160 or 320 at 15k, or maybe +even something slower. + +Rick + +pgsql-performance-owner@postgresql.org wrote on 07/26/2005 01:33:43 PM: + +> On Tue, Jul 26, 2005 at 11:23:23AM -0700, Luke Lonergan wrote: +> >Yup - interesting and very niche product - it seems like it's only +obvious +> >application is for the Postgresql WAL problem :-) +> +> On the contrary--it's not obvious that it is an ideal fit for a WAL. A +> ram disk like this is optimized for highly random access applications. +> The WAL is a single sequential writer. If you're in the kind of market +> that needs a really high performance WAL you'd be much better served by +> putting a big NVRAM cache in front of a fast disk array than by buying a +> toy like this. +> +> Mike Stone +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 17:05:18 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D124552C73 + for ; + Tue, 26 Jul 2005 17:05:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71256-03 + for ; + Tue, 26 Jul 2005 20:04:59 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id A8307529E1 + for ; + Tue, 26 Jul 2005 17:04:59 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id A8C7915232; Tue, 26 Jul 2005 15:05:00 -0500 (CDT) +Date: Tue, 26 Jul 2005 15:05:00 -0500 +From: "Jim C. Nasby" +To: Roberto Germano Vieweg Neto +Cc: pgsql-performance@postgresql.org +Subject: Re: [IMPORTANT] - My application performance +Message-ID: <20050726200500.GY29346@decibel.org> +References: <38776.200.101.246.47.1122406519.squirrel@popmail5.pop.com.br> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <38776.200.101.246.47.1122406519.squirrel@popmail5.pop.com.br> +X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/407 +X-Sequence-Number: 13648 + +The number of objects in your system has virtually nothing to do with +performance (at least on any decent database...) + +What is your application doing? What's the bottleneck right now? + +On Tue, Jul 26, 2005 at 04:35:19PM -0300, Roberto Germano Vieweg Neto wrote: +> My application is using Firebird 1.5.2 +> +> I have at my database: +> - 150 Doamins +> - 318 tables +> - 141 Views +> - 365 Procedures +> - 407 Triggers +> - 75 generators +> - 161 Exceptions +> - 183 UDFs +> - 1077 Indexes +> +> My question is: +> +> Postgre SQL will be more faster than Firebird? How much (in percent)? +> +> I need about 20% to 50% more performance at my application. +> Can I get this migratin to postgresql ? +> +> +> ---------------------------(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, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Tue Jul 26 18:03:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 57FA652BD5 + for ; + Tue, 26 Jul 2005 18:03:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84860-01 + for ; + Tue, 26 Jul 2005 21:03:18 +0000 (GMT) +Received: from dfbsa63.conab.gov.br (dfbsa63.conab.gov.br [200.140.131.205]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B22252CB3 + for ; + Tue, 26 Jul 2005 18:03:16 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by dfbsa63.conab.gov.br (Postfix) with ESMTP id 733C24C0DD + for ; + Tue, 26 Jul 2005 18:00:53 -0300 (BRT) +Received: from dfbsa63.conab.gov.br ([127.0.0.1]) + by localhost (dfbsa63 [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 04878-40 for ; + Tue, 26 Jul 2005 18:00:52 -0300 (BRT) +Received: from gesin557 (unknown [10.1.2.201]) + by dfbsa63.conab.gov.br (Postfix) with ESMTP id AB1294C0C7 + for ; + Tue, 26 Jul 2005 18:00:52 -0300 (BRT) +From: "Alvaro Neto" +To: +Subject: RES: [IMPORTANT] - My application performance +Date: Tue, 26 Jul 2005 18:00:52 -0300 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +X-Mailer: Microsoft Office Outlook, Build 11.0.5510 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +In-Reply-To: <38776.200.101.246.47.1122406519.squirrel@popmail5.pop.com.br> +Thread-Index: AcWSGRQpcSi61uyYSl+z6FlkKRCY0QAC/vrg +Message-Id: <20050726210052.AB1294C0C7@dfbsa63.conab.gov.br> +X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at conab.gov.br +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.18 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/408 +X-Sequence-Number: 13649 + +What's the your platform? Windows or Linux? +What's the data volume (up million records)? + +-----Mensagem original----- +De: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] Em nome de Roberto = +Germano +Vieweg Neto +Enviada em: ter=E7a-feira, 26 de julho de 2005 16:35 +Para: pgsql-performance@postgresql.org +Assunto: [PERFORM] [IMPORTANT] - My application performance + +My application is using Firebird 1.5.2 + +I have at my database: +- 150 Doamins +- 318 tables +- 141 Views +- 365 Procedures +- 407 Triggers +- 75 generators +- 161 Exceptions +- 183 UDFs +- 1077 Indexes + +My question is: + +Postgre SQL will be more faster than Firebird? How much (in percent)? + +I need about 20% to 50% more performance at my application. +Can I get this migratin to postgresql ? + + +---------------------------(end of broadcast)--------------------------- +TIP 9: In versions below 8.0, the planner will ignore your desire to + choose an index scan if your joining column's datatypes do not + match + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 20:04:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CFFDB52C9E + for ; + Tue, 26 Jul 2005 20:04:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54863-09 + for ; + Tue, 26 Jul 2005 23:04:02 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 40D3C52C7D + for ; + Tue, 26 Jul 2005 20:04:01 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id D522030B42; Wed, 27 Jul 2005 01:11:21 +0200 (MET DST) +From: Chris Browne +X-Newsgroups: pgsql.performance +Subject: Re: Cheap RAM disk? +Date: Tue, 26 Jul 2005 18:12:10 -0400 +Organization: cbbrowne Computing Inc +Lines: 22 +Message-ID: <60hdeh1akl.fsf@dba2.int.libertyrms.com> +References: <42E6661D.3060304@arbash-meinel.com> + <1122399740.12728.1.camel@toonses.gghcwest.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (Jumbo Shrimp, linux) +Cancel-Lock: sha1:upRZs9A+mI8OnclikGjycaSsg0E= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.122 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/410 +X-Sequence-Number: 13651 + +jwbaker@acm.org ("Jeffrey W. Baker") writes: +> I haven't tried this product, but the microbenchmarks seem truly +> slow. I think you would get a similar benefit by simply sticking a +> 1GB or 2GB DIMM -- battery-backed, of course -- in your RAID +> controller. + +Well, the microbenchmarks were pretty pre-sophomoric, essentially +trying to express how the device would be useful to a Windows user +that *might* play games... + +I'm sure it's hurt by the fact that it's using a SATA ("version 1") +interface rather than something faster. + +Mind you, I'd like to see the product succeed, because they might come +up with a "version 2" of it that is what I'd really like... +-- +(format nil "~S@~S" "cbbrowne" "acm.org") +http://www.ntlug.org/~cbbrowne/sap.html +Rules of the Evil Overlord #78. "I will not tell my Legions of Terror +"And he must be taken alive!" The command will be: ``And try to take +him alive if it is reasonably practical.''" + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 19:29:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4255C52F83 + for ; + Tue, 26 Jul 2005 19:29:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 32997-10 + for ; + Tue, 26 Jul 2005 22:29:23 +0000 (GMT) +Received: from mir3-fs.mir3.com (mail.mir3.com [216.74.11.46]) + by svr1.postgresql.org (Postfix) with ESMTP id 6810352CB0 + for ; + Tue, 26 Jul 2005 19:29:22 -0300 (ADT) +Received: from archimedes ([172.16.2.68]) by mir3-fs.mir3.com with Microsoft + SMTPSVC(5.0.2195.6713); Tue, 26 Jul 2005 15:32:17 -0700 +Subject: Re: faster INSERT with possible pre-existing row? +From: Mark Lewis +To: John A Meinel +Cc: newz@bearfruit.org, Dan Harris , + pgsql-performance@postgresql.org +In-Reply-To: <42E6942F.3070006@arbash-meinel.com> +References: + + <42E6942F.3070006@arbash-meinel.com> +Content-Type: text/plain +Organization: MIR3, Inc. +Date: Tue, 26 Jul 2005 15:29:23 -0700 +Message-Id: <1122416963.17503.25.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-16) +Content-Transfer-Encoding: 7bit +X-OriginalArrivalTime: 26 Jul 2005 22:32:17.0233 (UTC) + FILETIME=[E0CA3C10:01C59231] +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200507/409 +X-Sequence-Number: 13650 + +Easier and faster than doing the custom trigger is to simply define a +unique index and let the DB enforce the constraint with an index lookup, +something like: + +create unique index happy_index ON happy_table(col1, col2, col3); + +That should run faster than the custom trigger, but not as fast as the +temp table solution suggested elsewhere because it will need to do an +index lookup for each row. With this solution, it is important that +your shared_buffers are set high enough that the happy_index can be kept +in memory, otherwise performance will drop precipitously. Also, if you +are increasing the size of the table by a large percentage, you will +want to ANALYZE periodically, as an optimal plan for a small table may +be a disaster for a large table, and PostgreSQL won't switch plans +unless you run ANALYZE. + +-- Mark + +On Tue, 2005-07-26 at 14:51 -0500, John A Meinel wrote: +> Matthew Nuzum wrote: +> > On 7/26/05, Dan Harris wrote: +> > +> >>I am working on a process that will be inserting tens of million rows +> >>and need this to be as quick as possible. +> >> +> >>The catch is that for each row I could potentially insert, I need to +> >>look and see if the relationship is already there to prevent +> >>multiple entries. Currently I am doing a SELECT before doing the +> >>INSERT, but I recognize the speed penalty in doing to operations. I +> >>wonder if there is some way I can say "insert this record, only if it +> >>doesn't exist already". To see if it exists, I would need to compare +> >>3 fields instead of just enforcing a primary key. +> > +> > +> > I struggled with this for a while. At first I tried stored procedures +> > and triggers, but it took very long (over 24 hours for my dataset). +> > After several iterations of rewritting it, first into C# then into +> > Python I got the whole process down to under 30 min. +> > +> > My scenario is this: +> > I want to normalize log data. For example, for the IP address in a log +> > entry, I need to look up the unique id of the IP address, or if the IP +> > address is new, insert it and then return the newly created entry. +> > Multiple processes use the data, but only one process, run daily, +> > actually changes it. Because this one process knows that the data is +> > static, it selects the tables into in-memory hash tables (C#) or +> > Dictionaries (Python) and then does the lookups there. It is *super* +> > fast, but it uses a *lot* of ram. ;-) +> > +> > To limit the ram, I wrote a version of the python code that uses gdbm +> > files instead of Dictionaries. This requires a newer version of Python +> > (to allow a gdbm db to work just like a dictionary) but makes life +> > easier in case someone is using my software on a lower end machine. +> > This doubled the time of the lookups from about 15 minutes to 30, +> > bringing the whole process to about 45 minutes. +> > +> +> Did you ever try the temp table approach? You could: +> +> COPY all records into temp_table, with an empty row for ip_id +> -- Get any entries which already exist +> UPDATE temp_table SET ip_id = +> (SELECT ip_id from ipaddress WHERE add=add) +> WHERE EXISTS (SELECT ip_id FROM ipaddress WHERE add=add); +> -- Create new entries +> INSERT INTO ipaddress(add) SELECT add FROM temp_table +> WHERE ip_id IS NULL; +> -- Update the rest +> UPDATE temp_table SET ip_id = +> (SELECT ip_id from ipaddress WHERE add=add) +> WHERE ip_id IS NULL AND +> EXISTS (SELECT ip_id FROM ipaddress WHERE add=add); +> +> This would let the database do all of the updating work in bulk on it's +> side, rather than you pulling all the data out and doing it locally. +> +> An alternative would be something like: +> +> CREATE TEMP TABLE new_ids (address text, ip_id int); +> COPY all potentially new addresses into that table. +> -- Delete all entries which already exist +> DELETE FROM new_ids WHERE EXISTS +> (SELECT ip_id FROM ipaddresses +> WHERE add=new_ids.address); +> -- Now create the new entries +> INSERT INTO ipaddresses(add) SELECT address FROM new_ids; +> +> -- At this point you are guaranteed to have all addresses existing in +> -- the database +> +> If you then insert your full data into the final table, only leave the +> ip_id column as null. Then if you have a partial index where ip_id is +> NULL, you could use the command: +> +> UPDATE final_table SET ip_id = +> (SELECT ip_id FROM ipaddresses WHERE add=final_table.add) +> WHERE ip_id IS NULL; +> +> You could also do this in a temporary table, before bulk inserting into +> the final table. +> +> I don't know what you have tried, but I know that for Dan, he easily has +> > 36M rows. So I don't think he wants to pull that locally and create a +> in-memory hash just to insert 100 rows or so. +> +> Also, for your situation, if you do keep a local cache, you could +> certainly save the cache between runs, and use a temp table to determine +> what new ids you need to add to it. Then you wouldn't have to pull the +> complete set each time. You just pull new values for entries you haven't +> added yet. +> +> John +> =:-> + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 22:52:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7203752C0A + for ; + Tue, 26 Jul 2005 22:52:41 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88723-08 + for ; + Wed, 27 Jul 2005 01:52:40 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id E516452BD2 + for ; + Tue, 26 Jul 2005 22:52:38 -0300 (ADT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 1F52124FF7; + Wed, 27 Jul 2005 09:52:41 +0800 (WST) +Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 2D51824FF1; + Wed, 27 Jul 2005 09:52:39 +0800 (WST) +Message-ID: <42E6E9A3.4000400@familyhealth.com.au> +Date: Wed, 27 Jul 2005 09:55:47 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Dan Harris +Cc: pgsql-performance@postgresql.org +Subject: Re: faster INSERT with possible pre-existing row? +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-familyhealth-MailScanner-Information: Please contact the ISP for more + information +X-familyhealth-MailScanner: Found to be clean +X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/411 +X-Sequence-Number: 13652 + +Insert into a temp table then use INSERT INTO...SELECT FROM to insert +all rows into the proper table that don't have a relationship. + +Chris + +Dan Harris wrote: +> I am working on a process that will be inserting tens of million rows +> and need this to be as quick as possible. +> +> The catch is that for each row I could potentially insert, I need to +> look and see if the relationship is already there to prevent multiple +> entries. Currently I am doing a SELECT before doing the INSERT, but I +> recognize the speed penalty in doing to operations. I wonder if there +> is some way I can say "insert this record, only if it doesn't exist +> already". To see if it exists, I would need to compare 3 fields +> instead of just enforcing a primary key. +> +> Even if this could be a small increase per record, even a few percent +> faster compounded over the whole load could be a significant reduction. +> +> Thanks for any ideas you might have. +> +> -Dan +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend + + +From pgsql-performance-owner@postgresql.org Tue Jul 26 22:59:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E77DE52B29 + for ; + Tue, 26 Jul 2005 22:59:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87520-10 + for ; + Wed, 27 Jul 2005 01:59:06 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D5CC52C60 + for ; + Tue, 26 Jul 2005 22:59:05 -0300 (ADT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 7AD0F24FF2; + Wed, 27 Jul 2005 09:59:09 +0800 (WST) +Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 85EAA24FF1; + Wed, 27 Jul 2005 09:59:08 +0800 (WST) +Message-ID: <42E6EB2D.9040008@familyhealth.com.au> +Date: Wed, 27 Jul 2005 10:02:21 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Roberto Germano Vieweg Neto +Cc: pgsql-performance@postgresql.org +Subject: Re: [IMPORTANT] - My application performance +References: <38776.200.101.246.47.1122406519.squirrel@popmail5.pop.com.br> +In-Reply-To: <38776.200.101.246.47.1122406519.squirrel@popmail5.pop.com.br> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-familyhealth-MailScanner-Information: Please contact the ISP for more + information +X-familyhealth-MailScanner: Found to be clean +X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/412 +X-Sequence-Number: 13653 + + + +Roberto Germano Vieweg Neto wrote: +> My application is using Firebird 1.5.2 +> +> I have at my database: +> - 150 Doamins +> - 318 tables +> - 141 Views +> - 365 Procedures +> - 407 Triggers +> - 75 generators +> - 161 Exceptions +> - 183 UDFs +> - 1077 Indexes +> +> My question is: +> +> Postgre SQL will be more faster than Firebird? How much (in percent)? + +I think you can probably expect around 10341.426% improvement. + + + + + + + +ps. Yes, I am joking just in case... + + +From pgsql-performance-owner@postgresql.org Wed Jul 27 04:28:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EA13F52EBB + for ; + Wed, 27 Jul 2005 04:28:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 64629-07 + for ; + Wed, 27 Jul 2005 07:28:00 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.201]) + by svr1.postgresql.org (Postfix) with ESMTP id DE94152EDD + for ; + Wed, 27 Jul 2005 04:27:58 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 8so104624nzo + for ; + Wed, 27 Jul 2005 00:28:00 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=QSCGRSyaqvi0nKmeuQuxyHNuoozhJmEJSxAmlX9/mOJ0j1G3SBRvaDWTQLxqSvFvofKngmLyJqqGg4Gd3WVdDTG6l2zM6puDwLD7CWc1tUVJbWtKTNHBYayHsHoRke7U7iZ1QbWnjyxxqG1FOfm/YONpvVI5XFODcIJ3Y/sVxzo= +Received: by 10.37.12.49 with SMTP id p49mr608946nzi; + Wed, 27 Jul 2005 00:28:00 -0700 (PDT) +Received: by 10.36.22.20 with HTTP; Wed, 27 Jul 2005 00:28:00 -0700 (PDT) +Message-ID: <758d5e7f050727002844a1ad3c@mail.gmail.com> +Date: Wed, 27 Jul 2005 09:28:00 +0200 +From: Dawid Kuroczko +Reply-To: Dawid Kuroczko +To: Roberto Germano Vieweg Neto +Subject: Re: [IMPORTANT] - My application performance +Cc: pgsql-performance@postgresql.org +In-Reply-To: <38776.200.101.246.47.1122406519.squirrel@popmail5.pop.com.br> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <38776.200.101.246.47.1122406519.squirrel@popmail5.pop.com.br> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.617 tagged_above=0 required=5 tests=AWL, + FROM_ENDS_IN_NUMS, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/413 +X-Sequence-Number: 13654 + +On 7/26/05, Roberto Germano Vieweg Neto wrote: +> My application is using Firebird 1.5.2 +>=20 +> My question is: +>=20 +> Postgre SQL will be more faster than Firebird? How much (in percent)? +>=20 +> I need about 20% to 50% more performance at my application. +> Can I get this migratin to postgresql ? + +The answer is: maybe. There's nothing which stops PostgreSQL from +being faster, and likewise there is nothing that stops it from being +slower. YMMV. + +Your route should be: + * migrate most speed-demanding part to PostgreSQL + * benchmark it, trying to emulate real-world load. + * if it is slower than Firebird, post it here, together with EXPLAIN ANALY= +ZEs + and ask if there's something you can do to speed it up. + + Regards, + Dawid + +From pgsql-performance-owner@postgresql.org Wed Jul 27 04:56:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B096352EE0 + for ; + Wed, 27 Jul 2005 04:56:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 72467-08 + for ; + Wed, 27 Jul 2005 07:56:14 +0000 (GMT) +Received: from smtp1.asco.de (smtp1.asco.de [217.13.70.154]) + by svr1.postgresql.org (Postfix) with ESMTP id 5102C52EBE + for ; + Wed, 27 Jul 2005 04:56:12 -0300 (ADT) +Received: from [192.168.1.72] (pitr.asco.de [192.168.1.72]) + (envelope-sender: ) + (authenticated j_schicke CRAM-MD5 bits=0) + by smtp1.asco.de (8.13.4/8.13.4/Debian-3) with ESMTP id j6R7uC3U008048 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) + for ; Wed, 27 Jul 2005 09:56:12 +0200 +Date: Wed, 27 Jul 2005 09:56:12 +0200 +From: Jens-Wolfhard Schicke +Reply-To: Jens-Wolfhard Schicke +To: pgsql-performance@postgresql.org +Subject: Inherited Table Query Planning (fwd) +Message-ID: <66F42056CEA99778F918C7C9@[192.168.1.72]> +X-Mailer: Mulberry/3.1.6 (Linux/x86) +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1; format=flowed +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/414 +X-Sequence-Number: 13655 + +Is there a way to make the query planner consider pulling inner appends=20 +outside joins? + +Example: +natural_person inherits from person (obviously) + +admpostgres3=3D# explain analyze select u.name, p.name from users u, person = +p=20 +where p.user_id =3D u.id and u.name =3D 's_ohl'; + QUERY PLAN +----------------------------------------------------------------------------= +---------------------------------------------------------- + Hash Join (cost=3D8.01..3350.14 rows=3D3 width=3D36) (actual=20 +time=3D107.391..343.657 rows=3D10 loops=3D1) + Hash Cond: ("outer".user_id =3D "inner".id) + -> Append (cost=3D0.00..2461.34 rows=3D117434 width=3D20) (actual=20 +time=3D0.007..264.910 rows=3D117434 loops=3D1) + -> Seq Scan on person p (cost=3D0.00..575.06 rows=3D31606 = +width=3D20)=20 +(actual time=3D0.005..38.911 rows=3D31606 loops=3D1) + -> Seq Scan on natural_person p (cost=3D0.00..1886.28 = +rows=3D85828=20 +width=3D19) (actual time=3D0.003..104.338 rows=3D85828 loops=3D1) + -> Hash (cost=3D8.01..8.01 rows=3D2 width=3D24) (actual = +time=3D0.096..0.096=20 +rows=3D0 loops=3D1) + -> Index Scan using users_name_idx on users u (cost=3D0.00..8.01 = + +rows=3D2 width=3D24) (actual time=3D0.041..0.081 rows=3D10 loops=3D1) + Index Cond: ((name)::text =3D 's_ohl'::text) + Total runtime: 343.786 ms +(9 rows) + +admpostgres3=3D# explain analyze select u.name, p.name from users u, only=20 +person p where p.user_id =3D u.id and u.name =3D 's_ohl' union all select=20 +u.name, p.name from users u, only natural_person p where p.user_id =3D u.id = + +and u.name =3D 's_ohl'; + QUERY PLAN +----------------------------------------------------------------------------= +----------------------------------------------------------------------------= +----- + Append (cost=3D0.00..28.19 rows=3D3 width=3D28) (actual = +time=3D0.197..0.366=20 +rows=3D10 loops=3D1) + -> Subquery Scan "*SELECT* 1" (cost=3D0.00..14.12 rows=3D1 width=3D28) = + +(actual time=3D0.159..0.159 rows=3D0 loops=3D1) + -> Nested Loop (cost=3D0.00..14.11 rows=3D1 width=3D28) (actual=20 +time=3D0.157..0.157 rows=3D0 loops=3D1) + -> Index Scan using users_name_idx on users u=20 +(cost=3D0.00..8.01 rows=3D2 width=3D24) (actual time=3D0.039..0.075 = +rows=3D10 loops=3D1) + Index Cond: ((name)::text =3D 's_ohl'::text) + -> Index Scan using person_user_idx on person p=20 +(cost=3D0.00..3.03 rows=3D2 width=3D8) (actual time=3D0.006..0.006 rows=3D0 = +loops=3D10) + Index Cond: (p.user_id =3D "outer".id) + -> Subquery Scan "*SELECT* 2" (cost=3D0.00..14.08 rows=3D2 width=3D28) = + +(actual time=3D0.036..0.193 rows=3D10 loops=3D1) + -> Nested Loop (cost=3D0.00..14.06 rows=3D2 width=3D28) (actual=20 +time=3D0.033..0.171 rows=3D10 loops=3D1) + -> Index Scan using users_name_idx on users u=20 +(cost=3D0.00..8.01 rows=3D2 width=3D24) (actual time=3D0.018..0.049 = +rows=3D10 loops=3D1) + Index Cond: ((name)::text =3D 's_ohl'::text) + -> Index Scan using natural_person_user_idx on=20 +natural_person p (cost=3D0.00..3.01 rows=3D1 width=3D8) (actual=20 +time=3D0.006..0.007 rows=3D1 loops=3D10) + Index Cond: (p.user_id =3D "outer".id) + Total runtime: 0.475 ms +(14 rows) + + +Mit freundlichem Gru=DF +Jens Schicke +--=20 +Jens Schicke j.schicke@asco.de +asco GmbH http://www.asco.de +Mittelweg 7 Tel 0531/3906-127 +38106 Braunschweig Fax 0531/3906-400 + +From pgsql-performance-owner@postgresql.org Wed Jul 27 11:22:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6D23452C32 + for ; + Wed, 27 Jul 2005 11:09:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61958-06 + for ; + Wed, 27 Jul 2005 14:09:07 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6C2F152C06 + for ; + Wed, 27 Jul 2005 11:09:07 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6RE98PA025524; + Wed, 27 Jul 2005 10:09:08 -0400 (EDT) +To: Jens-Wolfhard Schicke +Cc: pgsql-performance@postgresql.org +Subject: Re: Inherited Table Query Planning (fwd) +In-reply-to: <66F42056CEA99778F918C7C9@[192.168.1.72]> +References: <66F42056CEA99778F918C7C9@[192.168.1.72]> +Comments: In-reply-to Jens-Wolfhard Schicke + message dated "Wed, 27 Jul 2005 09:56:12 +0200" +Date: Wed, 27 Jul 2005 10:09:08 -0400 +Message-ID: <25523.1122473348@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/415 +X-Sequence-Number: 13656 + +Jens-Wolfhard Schicke writes: +> Is there a way to make the query planner consider pulling inner appends +> outside joins? + +Not at the moment. + + regards, tom lane + +From pgsql-admin-owner@postgresql.org Wed Jul 27 12:12:47 2005 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C312A52C45 + for ; + Wed, 27 Jul 2005 12:12:35 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76070-10 + for ; + Wed, 27 Jul 2005 15:12:28 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.207]) + by svr1.postgresql.org (Postfix) with ESMTP id 8DB7E52BC5 + for ; Wed, 27 Jul 2005 12:12:27 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 13so177137nzn + for ; Wed, 27 Jul 2005 08:12:27 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; + b=jP5pTM/Kw5CCnHGTd15Jb+rUJ8yLJYNzeSxd27A9iRgfl1zVcMzY06fUXUU/CG4KGAticXT68cF0uSnUlPK1kkDEw4obp96Z7/NITmxUquxrcc+bFBRhL60bdqyAA93iNLm+rSd9caaeVkjryONWv35UwBO+dt3TZE2iEgh1aBg= +Received: by 10.36.177.1 with SMTP id z1mr983068nze; + Wed, 27 Jul 2005 08:12:27 -0700 (PDT) +Received: by 10.36.25.13 with HTTP; Wed, 27 Jul 2005 08:12:27 -0700 (PDT) +Message-ID: <1d219a6f05072708122cf6abeb@mail.gmail.com> +Date: Wed, 27 Jul 2005 11:12:27 -0400 +From: Chris Hoover +Reply-To: Chris Hoover +To: pgsql-admin@postgresql.org +Subject: Help with view performance problem +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/222 +X-Sequence-Number: 18278 + +I am having a problem with a view on one of my db's. This view is +trying to sequentially can the 2 tables it is accessing. However, +when I explain the view on most of my other db's (all have the same +schema's), it is using the indexes. Can anyone please help me +understand why postgres is choosing to sequenially scan both tables? + +Both tables in the view have a primary key defined on inv_nbr, +inv_qfr. Vacuum and analyze have been run on the tables in question +to try and make sure stats are up to date. + +Thanks, + +Chris +PG - 7.3.4 +RH 2.1 + + +Here is the view definition: +SELECT DISTINCT clmcom1.inv_nbr AS inventory_number,=20 + clmcom1.inv_qfr AS inventory_qualifier,=20 + clmcom1.pat_addr_1 AS patient_address_1,=20 + clmcom1.pat_addr_2 AS patient_address_2,=20 + clmcom1.pat_city AS patient_city,=20 + clmcom1.pat_cntry AS patient_country,=20 + clmcom1.pat_dob AS patient_date_of_birth,=20 + clmcom1.pat_gender_cd AS patient_gender_code, + clmcom1.pat_info_pregnancy_ind AS pregnancy_i= +nd, + clmcom1.pat_state AS patient_state,=20 + clmcom1.pat_suffix AS patient_suffix,=20 + clmcom1.pat_zip AS patient_zip_code,=20 + clmcom1.payto_addr_1 AS payto_address_1,=20 + clmcom1.payto_addr_2 AS payto_address_2,=20 + clmcom1.payto_city,=20 + clmcom1.payto_cntry AS payto_country,=20 + clmcom1.payto_f_name AS payto_first_name,=20 + clmcom1.payto_m_name AS payto_middle_name, + clmcom1.payto_state,=20 + clmcom1.payto_zip AS payto_zip_code,=20 + clmcom1.clm_tot_clm_chgs AS total_claim_charg= +e,=20 + clmcom1.bill_l_name_org AS +billing_last_name_or_org, + clmcom1.clm_delay_rsn_cd AS +claim_delay_reason_code, + clmcom1.clm_submit_rsn_cd AS +claim_submit_reason_code, + clmcom1.payto_l_name_org AS +payto_last_name_or_org, + clmcom1.payto_prim_id AS payto_primary_id, = +=20 + clmcom1.bill_prim_id AS billing_prov_primary_= +id, + clmcom1.clm_tot_ncov_chgs AS total_ncov_charg= +e,=20 + clmcom2.contract_amt AS contract_amount,=20 + clmcom2.svc_fac_or_lab_name,=20 + clmcom2.svc_fac_addr_1 AS svc_fac_address_1,= +=20 + clmcom2.svc_fac_addr_2 AS svc_fac_address_2,= +=20 + clmcom2.svc_fac_city,=20 + clmcom2.svc_fac_zip AS svc_fac_zip_code=20 +FROM (clmcom1 LEFT JOIN clmcom2 ON (((clmcom1.inv_nbr =3D +clmcom2.inv_nbr) AND + =20 +(clmcom1.inv_qfr =3D clmcom2.inv_qfr)))) +ORDER BY clmcom1.inv_nbr,=20 + clmcom1.inv_qfr,=20 + clmcom1.pat_addr_1,=20 + clmcom1.pat_addr_2,=20 + clmcom1.pat_city,=20 + clmcom1.pat_cntry, + clmcom1.pat_dob,=20 + clmcom1.pat_gender_cd,=20 + clmcom1.pat_info_pregnancy_ind,=20 + clmcom1.pat_state,=20 + clmcom1.pat_suffix,=20 + clmcom1.pat_zip,=20 + clmcom1.payto_addr_1,=20 + clmcom1.payto_addr_2,=20 + clmcom1.payto_city,=20 + clmcom1.payto_cntry, + clmcom1.payto_f_name,=20 + clmcom1.payto_m_name,=20 + clmcom1.payto_state,=20 + clmcom1.payto_zip,=20 + clmcom1.clm_tot_clm_chgs,=20 + clmcom1.bill_l_name_org,=20 + clmcom1.clm_delay_rsn_cd,=20 + clmcom1.clm_submit_rsn_cd,=20 + clmcom1.payto_l_name_org,=20 + clmcom1.payto_prim_id,=20 + clmcom1.bill_prim_id,=20 + clmcom1.clm_tot_ncov_chgs,=20 + clmcom2.contract_amt,=20 + clmcom2.svc_fac_or_lab_name,=20 + clmcom2.svc_fac_addr_1,=20 + clmcom2.svc_fac_addr_2,=20 + clmcom2.svc_fac_city,=20 + clmcom2.svc_fac_zip; + + +Here is the explain analyze from the problem db: +prob_db=3D# explain analyze select * from clm_com; + + + =20 + QUERY PLAN + + + +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +-------------------------- + Subquery Scan clm_com (cost=3D1039824.35..1150697.61 rows=3D126712 +width=3D367) (actual time=3D311792.78..405819.03 rows=3D1266114 loops=3D1) + -> Unique (cost=3D1039824.35..1150697.61 rows=3D126712 width=3D367) +(actual time=3D311792.74..386313.14 rows=3D1266114 loops=3D1) + -> Sort (cost=3D1039824.35..1042992.16 rows=3D1267123 +width=3D367) (actual time=3D311792.74..338189.48 rows=3D1266114 loops=3D1) + Sort Key: clmcom1.inv_nbr, clmcom1.inv_qfr, +clmcom1.pat_addr_1, clmcom1.pat_addr_2, clmcom1.pat_city, +clmcom1.pat_cntry, clmcom1.pat_dob, clmcom1.pat_gender_cd, +clmcom1.pat_info_pregnancy_ind, clmcom1.pat_state, clmcom1.pat_suffix, +clmcom1.pat_zip, clmcom1.payto_addr_1, +clmcom1.payto_addr_2, clmcom1.payto_city, clmcom1.payto_cntry, +clmcom1.payto_f_name, clmcom1.payto_m_name, clmcom1.payto_state, +clmcom1.payto_zip, clmcom1.clm_tot_clm_chgs, clmcom1.bill_l_name_org, +clmcom1.clm_delay_rsn_cd, clmcom1.clm_submit_rsn_cd, +clmcom1.payto_l_name_org, clmcom1.payto_prim_id, clmcom1.bill_prim_id, +clmcom1.clm_tot_ncov_chgs, clmcom2.contract_amt, +clmcom2.svc_fac_or_lab_name, clmcom2.svc_fac_addr_1, +clmcom2.svc_fac_addr_2, clmcom2.svc_fac_city, clmcom2.svc_fac_zip + -> Hash Join (cost=3D132972.78..548171.70 rows=3D1267123 +width=3D367) (actual time=3D16999.32..179359.43 rows=3D1266114 loops=3D1) + Hash Cond: ("outer".inv_nbr =3D "inner".inv_nbr) + Join Filter: ("outer".inv_qfr =3D "inner".inv_qfr) + -> Seq Scan on clmcom1 (cost=3D0.00..267017.23 +rows=3D1267123 width=3D271) (actual time=3D0.11..84711.83 rows=3D1266114 +loops=3D1) + -> Hash (cost=3D111200.82..111200.82 rows=3D1269582 +width=3D96) (actual time=3D16987.45..16987.45 rows=3D0 loops=3D1) + -> Seq Scan on clmcom2=20 +(cost=3D0.00..111200.82 rows=3D1269582 width=3D96) (actual +time=3D0.07..12164.81 rows=3D1266108 loops=3D1) + Total runtime: 407317.47 msec +(11 rows) +~ + + + +Here is the explain analyze from a good db (on the same postgres cluster); +good_db=3D# explain analyze select * from clm_com; + =20 + =20 + =20 + =20 + =20 + QUERY PLAN +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +-------------------------- + Subquery Scan clm_com (cost=3D78780.59..89498.29 rows=3D12249 width=3D359= +) +(actual time=3D73045.36..79974.37 rows=3D122494 loops=3D1) + -> Unique (cost=3D78780.59..89498.29 rows=3D12249 width=3D359) (actual +time=3D73045.28..78031.99 rows=3D122494 loops=3D1) + -> Sort (cost=3D78780.59..79086.81 rows=3D122488 width=3D359) +(actual time=3D73045.28..73362.94 rows=3D122494 loops=3D1) + Sort Key: clmcom1.inv_nbr, clmcom1.inv_qfr, +clmcom1.pat_addr_1, clmcom1.pat_addr_2, clmcom1.pat_city, +clmcom1.pat_cntry, clmcom1.pat_dob, clmcom1.pat_gender_cd, +clmcom1.pat_info_pregnancy_ind, clmcom1.pat_state, clmcom1.pat_suffix, +clmcom1.pat_zip, clmcom1.payto_addr_1, clmcom1.payto_addr_2, +clmcom1.payto_city, clmcom1.payto_cntry, clmcom1.payto_f_name, +clmcom1.payto_m_name, clmcom1.payto_state, clmcom1.payto_zip, +clmcom1.clm_tot_clm_chgs, clmcom1.bill_l_name_org, +clmcom1.clm_delay_rsn_cd, clmcom1.clm_submit_rsn_cd, +clmcom1.payto_l_name_org, clmcom1.payto_prim_id, clmcom1.bill_prim_id, +clmcom1.clm_tot_ncov_chgs, clmcom2.contract_amt, +clmcom2.svc_fac_or_lab_name, clmcom2.svc_fac_addr_1, +clmcom2.svc_fac_addr_2, clmcom2.svc_fac_city, clmcom2.svc_fac_zip + -> Merge Join (cost=3D0.00..56945.12 rows=3D122488 +width=3D359) (actual time=3D54.76..71635.65 rows=3D122494 loops=3D1) + Merge Cond: (("outer".inv_nbr =3D "inner".inv_nbr) +AND ("outer".inv_qfr =3D "inner".inv_qfr)) + -> Index Scan using clmcom1_pkey on clmcom1=20 +(cost=3D0.00..38645.61 rows=3D122488 width=3D267) (actual +time=3D25.60..49142.16 rows=3D122494 loops=3D1) + -> Index Scan using clmcom2_pkey on clmcom2=20 +(cost=3D0.00..16004.08 rows=3D122488 width=3D92) (actual +time=3D29.09..19418.94 rows=3D122494 loops=3D1) + Total runtime: 80162.26 msec +(9 rows) + +From pgsql-performance-owner@postgresql.org Wed Jul 27 13:20:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 62C6652FBB + for ; + Wed, 27 Jul 2005 13:20:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01620-02 + for ; + Wed, 27 Jul 2005 16:20:01 +0000 (GMT) +Received: from wsmailap01.firstam.com (outbound-smtp01.firstam.com + [208.246.101.197]) + by svr1.postgresql.org (Postfix) with ESMTP id 98C6252FA1 + for ; + Wed, 27 Jul 2005 13:19:59 -0300 (ADT) +Received: from 172.21.131.5 by wsmailap02.firstam.com with ESMTP ( + Tumbleweed MMS SMTP Relay (MMS v5.6.3)); Wed, 27 Jul 2005 09:19:33 + -0700 +X-Server-Uuid: 7F57BFB8-2F8F-44C6-8C75-DD639B93CEA6 +Received: from anammx01.ana.firstamdata.com ([192.168.173.35]) by + famarp01.firstam.com (MOS 3.5.6-GR) with SMTP id EGN46487; Wed, 27 Jul + 2005 09:19:42 -0700 (PDT) +Received: from pisgana01sxch21.ana.firstamdata.com (Not + Verified[192.168.173.71]) by mailgateway.firstam.com (post.office MTA + v5.0 0924 ) with ESMTP id ; Wed, 27 Jul 2005 09:19:42 -0700 +Received: from pisgana01sxch01.ana.firstamdata.com ([192.168.173.70]) by + pisgana01sxch21.ana.firstamdata.com with Microsoft SMTPSVC(6.0.3790.211 + ); Wed, 27 Jul 2005 09:19:42 -0700 +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: Re: "Vacuum Full Analyze" taking so long +Date: Wed, 27 Jul 2005 09:19:42 -0700 +Message-ID: + +Thread-Topic: [PERFORM] "Vacuum Full Analyze" taking so long +Thread-Index: AcWRygCzjHVwQ9A7SjSkd+zv60r8ogA/N/LA +From: "Tomeh, Husam" +To: pgsql-performance@postgresql.org +X-OriginalArrivalTime: 27 Jul 2005 16:19:42.0305 (UTC) + FILETIME=[FEA0AD10:01C592C6] +X-WSS-ID: 6EF96B9B23K1603738-02-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/416 +X-Sequence-Number: 13657 + +Thank you all for your great input. It sure helped.=20 + +--=20 +=20Husam=20 + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Jochem van +Dieten +Sent: Tuesday, July 26, 2005 2:58 AM +To: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] "Vacuum Full Analyze" taking so long + +Tomeh, Husam wrote: +> The other question I have. What would be the proper approach to=20 +> rebuild indexes. I re-indexes and then run vacuum/analyze. Should I=20 +> not use the re-index approach, and instead, drop the indexes, vacuum=20 +> the tables, and then create the indexes, then run analyze on tables +and indexes?? + +If you just want to rebuild indexes, just drop and recreate. + +However, you are also running a VACUUM FULL, so I presume you have +deleted a significant number of rows and want to recover the space that +was in use by them. In that scenario, it is often better to CLUSTER the +table to force a rebuild. While VACUUM FULL moves the tuples around +inside the existing file(s), CLUSTER simply creates new file(s), moves +all the non-deleted tuples there and then swaps the old and the new +files. There can be a significant performance increase in doing so (but +you obviously need to have some free diskspace). +If you CLUSTER your table it will be ordered by the index you specify. +There can be a performance increase in doing so, but if you don't want +to you can also do a no-op ALTER TABLE and change a column to a datatype +that is the same as it already has. This too will force a rewrite of the +table but without ordering the tuples. + +So in short my recommendations: +- to rebuild indexes, just drop and recreate the indexes +- to rebuild everything because there is space that can bepermanently +reclaimed, drop indexes, cluster or alter the table, recreate the +indexes and anlyze the table + +Jochem + +---------------------------(end of broadcast)--------------------------- +TIP 3: Have you checked our extensive FAQ? + +=20 http://www.postgresql.org/docs/faq + +********************************************************************** +This message contains confidential information intended only for the=20 +use of the addressee(s) named above and may contain information that=20 +is legally privileged. If you are not the addressee, or the person=20 +responsible for delivering it to the addressee, you are hereby=20 +notified that reading, disseminating, distributing or copying this=20 +message is strictly prohibited. If you have received this message by=20 +mistake, please immediately notify us by replying to the message and=20 +delete the original message immediately thereafter. + +Thank you. FADLD Tag +********************************************************************** + + +From pgsql-performance-owner@postgresql.org Wed Jul 27 13:28:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0CF0E52E52 + for ; + Wed, 27 Jul 2005 13:28:21 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02541-06 + for ; + Wed, 27 Jul 2005 16:28:19 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id A2A2452C2C + for ; + Wed, 27 Jul 2005 13:28:18 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7660937; Wed, 27 Jul 2005 09:30:29 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: [Bizgres-general] Re: faster INSERT with possible +Date: Wed, 27 Jul 2005 09:29:09 -0700 +User-Agent: KMail/1.8 +Cc: "Luke Lonergan" , + "Hannu Krosing" , + "John A Meinel" , + "Dan Harris" , + "bizgres-general" +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: <200507270929.10251.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/417 +X-Sequence-Number: 13658 + +Luke, + +> Well - now that I test it, it appears you are correct, temp table COPY +> bypasses WAL - thanks for pointing it out! + +RIght. The problem is bypassing WAL for loading new "scratch" tables which +aren't TEMPORARY tables. We need to do this for multi-threaded ETL, since: +a) Temp tables can't be shared by several writers, and +b) you can't index a temp table. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-admin-owner@postgresql.org Wed Jul 27 13:29:22 2005 +X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C822E52E87 + for ; + Wed, 27 Jul 2005 13:29:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04284-02 + for ; + Wed, 27 Jul 2005 16:29:16 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.203]) + by svr1.postgresql.org (Postfix) with ESMTP id 87BE452E52 + for ; Wed, 27 Jul 2005 13:29:15 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 8so169217nzo + for ; Wed, 27 Jul 2005 09:29:15 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=P8e4w7oXjC0mSb023HnNcF+pzI0BLq9wi4mySnMtyJNKIEOmsgTZMddlHx02WYCSY545ZnRK+iehHOg3Gu/5STzfG2bsy/+S1Kb9OAYegjxvnZ/eRnryZmM1qiIk/naadKGRofBZvpTT+sN5BhlOvp7mpNpck2zHbq2JelVw5Uc= +Received: by 10.36.7.20 with SMTP id 20mr1087241nzg; + Wed, 27 Jul 2005 09:29:15 -0700 (PDT) +Received: by 10.36.25.13 with HTTP; Wed, 27 Jul 2005 09:29:14 -0700 (PDT) +Message-ID: <1d219a6f050727092927746db1@mail.gmail.com> +Date: Wed, 27 Jul 2005 12:29:14 -0400 +From: Chris Hoover +Reply-To: Chris Hoover +To: pgsql-admin@postgresql.org +Subject: Re: Help with view performance problem +In-Reply-To: <1d219a6f05072708122cf6abeb@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <1d219a6f05072708122cf6abeb@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/226 +X-Sequence-Number: 18282 + +I did some more testing, and ran the explain analyze on the problem.=20 +In my session I did a set enable_hashjoin =3D false and then ran the +analyze. This caused it to use the indexes as I have been expecting +it to do. + +Now, how can I get it to use the indexes w/o manipulating the +environment? What make postgresql want to sequentially scan and use a +hash join? + +thanks, + +Chris + +explain analyze with set_hashjoin=3Dfalse; +prob_db=3D#explain analyze select * from clm_com; + + + =20 + QUERY PLAN + + + +---------------------------------------------------------------------------= +------------------------------------------------------------------- +---------------------------------------------------------------------------= +------------------------------------------------------------------- +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +------------------------------------------ + Subquery Scan clm_com (cost=3D1057975.45..1169021.26 rows=3D126910 +width=3D366) (actual time=3D142307.99..225997.22 rows=3D1268649 loops=3D1) + -> Unique (cost=3D1057975.45..1169021.26 rows=3D126910 width=3D366) +(actual time=3D142307.96..206082.30 rows=3D1268649 loops=3D1) + -> Sort (cost=3D1057975.45..1061148.19 rows=3D1269095 +width=3D366) (actual time=3D142307.95..156019.01 rows=3D1268649 loops=3D1) + Sort Key: clmcom1.inv_nbr, clmcom1.inv_qfr, +clmcom1.pat_addr_1, clmcom1.pat_addr_2, clmcom1.pat_city, +clmcom1.pat_cntry, clmcom1.pat_dob, clmcom1.pat_gender_cd, +clmcom1.pat_info_pregnancy_ind, clmcom1.pat_state, clmcom1.pat_suffix, +clmcom1.pat_zip, clmcom1.payto_addr_1, +clmcom1.payto_addr_2, clmcom1.payto_city, clmcom1.payto_cntry, +clmcom1.payto_f_name, clmcom1.payto_m_name, clmcom1.payto_state, +clmcom1.payto_zip, clmcom1.clm_tot_clm_chgs, clmcom1.bill_l_name_org, +clmcom1.clm_delay_rsn_cd, clmcom1.clm_submit_rsn_cd, +clmcom1.payto_l_name_org, clmcom1.payto_prim_id, clmcom1.bill_prim_id, +clmcom1.clm_tot_ncov_chgs, clmcom2.contract_amt, +clmcom2.svc_fac_or_lab_name, clmcom2.svc_fac_addr_1, +clmcom2.svc_fac_addr_2, clmcom2.svc_fac_city, clmcom2.svc_fac_zip + -> Merge Join (cost=3D0.00..565541.46 rows=3D1269095 +width=3D366) (actual time=3D464.89..130638.06 rows=3D1268649 loops=3D1) + Merge Cond: ("outer".inv_nbr =3D "inner".inv_nbr) + Join Filter: ("outer".inv_qfr =3D "inner".inv_qfr) + -> Index Scan using clmcom1_inv_nbr_iview_idx on +clmcom1 (cost=3D0.00..380534.32 rows=3D1269095 width=3D270) (actual +time=3D0.27..82159.37 rows=3D1268649 loops=3D1) + -> Index Scan using clmcom2_inv_nbr_iview_idx on +clmcom2 (cost=3D0.00..159636.25 rows=3D1271198 width=3D96) (actual +time=3D464.56..21774.02 rows=3D1494019 loops=3D1) + Total runtime: 227369.39 msec +(10 rows) + + + +On 7/27/05, Chris Hoover wrote: +> I am having a problem with a view on one of my db's. This view is +> trying to sequentially can the 2 tables it is accessing. However, +> when I explain the view on most of my other db's (all have the same +> schema's), it is using the indexes. Can anyone please help me +> understand why postgres is choosing to sequenially scan both tables? +>=20 +> Both tables in the view have a primary key defined on inv_nbr, +> inv_qfr. Vacuum and analyze have been run on the tables in question +> to try and make sure stats are up to date. +>=20 +> Thanks, +>=20 +> Chris +> PG - 7.3.4 +> RH 2.1 +>=20 +>=20 +> Here is the view definition: +> SELECT DISTINCT clmcom1.inv_nbr AS inventory_number, +> clmcom1.inv_qfr AS inventory_qualifier, +> clmcom1.pat_addr_1 AS patient_address_1, +> clmcom1.pat_addr_2 AS patient_address_2, +> clmcom1.pat_city AS patient_city, +> clmcom1.pat_cntry AS patient_country, +> clmcom1.pat_dob AS patient_date_of_birth, +> clmcom1.pat_gender_cd AS patient_gender_cod= +e, +> clmcom1.pat_info_pregnancy_ind AS pregnancy= +_ind, +> clmcom1.pat_state AS patient_state, +> clmcom1.pat_suffix AS patient_suffix, +> clmcom1.pat_zip AS patient_zip_code, +> clmcom1.payto_addr_1 AS payto_address_1, +> clmcom1.payto_addr_2 AS payto_address_2, +> clmcom1.payto_city, +> clmcom1.payto_cntry AS payto_country, +> clmcom1.payto_f_name AS payto_first_name, +> clmcom1.payto_m_name AS payto_middle_name, +> clmcom1.payto_state, +> clmcom1.payto_zip AS payto_zip_code, +> clmcom1.clm_tot_clm_chgs AS total_claim_cha= +rge, +> clmcom1.bill_l_name_org AS +> billing_last_name_or_org, +> clmcom1.clm_delay_rsn_cd AS +> claim_delay_reason_code, +> clmcom1.clm_submit_rsn_cd AS +> claim_submit_reason_code, +> clmcom1.payto_l_name_org AS +> payto_last_name_or_org, +> clmcom1.payto_prim_id AS payto_primary_id, +> clmcom1.bill_prim_id AS billing_prov_primar= +y_id, +> clmcom1.clm_tot_ncov_chgs AS total_ncov_cha= +rge, +> clmcom2.contract_amt AS contract_amount, +> clmcom2.svc_fac_or_lab_name, +> clmcom2.svc_fac_addr_1 AS svc_fac_address_1= +, +> clmcom2.svc_fac_addr_2 AS svc_fac_address_2= +, +> clmcom2.svc_fac_city, +> clmcom2.svc_fac_zip AS svc_fac_zip_code +> FROM (clmcom1 LEFT JOIN clmcom2 ON (((clmcom1.inv_nbr =3D +> clmcom2.inv_nbr) AND +>=20 +> (clmcom1.inv_qfr =3D clmcom2.inv_qfr)))) +> ORDER BY clmcom1.inv_nbr, +> clmcom1.inv_qfr, +> clmcom1.pat_addr_1, +> clmcom1.pat_addr_2, +> clmcom1.pat_city, +> clmcom1.pat_cntry, +> clmcom1.pat_dob, +> clmcom1.pat_gender_cd, +> clmcom1.pat_info_pregnancy_ind, +> clmcom1.pat_state, +> clmcom1.pat_suffix, +> clmcom1.pat_zip, +> clmcom1.payto_addr_1, +> clmcom1.payto_addr_2, +> clmcom1.payto_city, +> clmcom1.payto_cntry, +> clmcom1.payto_f_name, +> clmcom1.payto_m_name, +> clmcom1.payto_state, +> clmcom1.payto_zip, +> clmcom1.clm_tot_clm_chgs, +> clmcom1.bill_l_name_org, +> clmcom1.clm_delay_rsn_cd, +> clmcom1.clm_submit_rsn_cd, +> clmcom1.payto_l_name_org, +> clmcom1.payto_prim_id, +> clmcom1.bill_prim_id, +> clmcom1.clm_tot_ncov_chgs, +> clmcom2.contract_amt, +> clmcom2.svc_fac_or_lab_name, +> clmcom2.svc_fac_addr_1, +> clmcom2.svc_fac_addr_2, +> clmcom2.svc_fac_city, +> clmcom2.svc_fac_zip; +>=20 +>=20 +> Here is the explain analyze from the problem db: +> prob_db=3D# explain analyze select * from clm_com; +>=20 +>=20 +>=20 +> QUERY PLAN +>=20 +>=20 +>=20 +> -------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------- +> Subquery Scan clm_com (cost=3D1039824.35..1150697.61 rows=3D126712 +> width=3D367) (actual time=3D311792.78..405819.03 rows=3D1266114 loops=3D1= +) +> -> Unique (cost=3D1039824.35..1150697.61 rows=3D126712 width=3D367) +> (actual time=3D311792.74..386313.14 rows=3D1266114 loops=3D1) +> -> Sort (cost=3D1039824.35..1042992.16 rows=3D1267123 +> width=3D367) (actual time=3D311792.74..338189.48 rows=3D1266114 loops=3D1= +) +> Sort Key: clmcom1.inv_nbr, clmcom1.inv_qfr, +> clmcom1.pat_addr_1, clmcom1.pat_addr_2, clmcom1.pat_city, +> clmcom1.pat_cntry, clmcom1.pat_dob, clmcom1.pat_gender_cd, +> clmcom1.pat_info_pregnancy_ind, clmcom1.pat_state, clmcom1.pat_suffix, +> clmcom1.pat_zip, clmcom1.payto_addr_1, +> clmcom1.payto_addr_2, clmcom1.payto_city, clmcom1.payto_cntry, +> clmcom1.payto_f_name, clmcom1.payto_m_name, clmcom1.payto_state, +> clmcom1.payto_zip, clmcom1.clm_tot_clm_chgs, clmcom1.bill_l_name_org, +> clmcom1.clm_delay_rsn_cd, clmcom1.clm_submit_rsn_cd, +> clmcom1.payto_l_name_org, clmcom1.payto_prim_id, clmcom1.bill_prim_id, +> clmcom1.clm_tot_ncov_chgs, clmcom2.contract_amt, +> clmcom2.svc_fac_or_lab_name, clmcom2.svc_fac_addr_1, +> clmcom2.svc_fac_addr_2, clmcom2.svc_fac_city, clmcom2.svc_fac_zip +> -> Hash Join (cost=3D132972.78..548171.70 rows=3D1267123 +> width=3D367) (actual time=3D16999.32..179359.43 rows=3D1266114 loops=3D1) +> Hash Cond: ("outer".inv_nbr =3D "inner".inv_nbr) +> Join Filter: ("outer".inv_qfr =3D "inner".inv_qfr) +> -> Seq Scan on clmcom1 (cost=3D0.00..267017.23 +> rows=3D1267123 width=3D271) (actual time=3D0.11..84711.83 rows=3D1266114 +> loops=3D1) +> -> Hash (cost=3D111200.82..111200.82 rows=3D126958= +2 +> width=3D96) (actual time=3D16987.45..16987.45 rows=3D0 loops=3D1) +> -> Seq Scan on clmcom2 +> (cost=3D0.00..111200.82 rows=3D1269582 width=3D96) (actual +> time=3D0.07..12164.81 rows=3D1266108 loops=3D1) +> Total runtime: 407317.47 msec +> (11 rows) +> ~ +>=20 +>=20 +>=20 +> Here is the explain analyze from a good db (on the same postgres cluster)= +; +> good_db=3D# explain analyze select * from clm_com; +>=20 +>=20 +>=20 +>=20 +>=20 +> QUERY PLAN +> -------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------- +> Subquery Scan clm_com (cost=3D78780.59..89498.29 rows=3D12249 width=3D3= +59) +> (actual time=3D73045.36..79974.37 rows=3D122494 loops=3D1) +> -> Unique (cost=3D78780.59..89498.29 rows=3D12249 width=3D359) (actu= +al +> time=3D73045.28..78031.99 rows=3D122494 loops=3D1) +> -> Sort (cost=3D78780.59..79086.81 rows=3D122488 width=3D359) +> (actual time=3D73045.28..73362.94 rows=3D122494 loops=3D1) +> Sort Key: clmcom1.inv_nbr, clmcom1.inv_qfr, +> clmcom1.pat_addr_1, clmcom1.pat_addr_2, clmcom1.pat_city, +> clmcom1.pat_cntry, clmcom1.pat_dob, clmcom1.pat_gender_cd, +> clmcom1.pat_info_pregnancy_ind, clmcom1.pat_state, clmcom1.pat_suffix, +> clmcom1.pat_zip, clmcom1.payto_addr_1, clmcom1.payto_addr_2, +> clmcom1.payto_city, clmcom1.payto_cntry, clmcom1.payto_f_name, +> clmcom1.payto_m_name, clmcom1.payto_state, clmcom1.payto_zip, +> clmcom1.clm_tot_clm_chgs, clmcom1.bill_l_name_org, +> clmcom1.clm_delay_rsn_cd, clmcom1.clm_submit_rsn_cd, +> clmcom1.payto_l_name_org, clmcom1.payto_prim_id, clmcom1.bill_prim_id, +> clmcom1.clm_tot_ncov_chgs, clmcom2.contract_amt, +> clmcom2.svc_fac_or_lab_name, clmcom2.svc_fac_addr_1, +> clmcom2.svc_fac_addr_2, clmcom2.svc_fac_city, clmcom2.svc_fac_zip +> -> Merge Join (cost=3D0.00..56945.12 rows=3D122488 +> width=3D359) (actual time=3D54.76..71635.65 rows=3D122494 loops=3D1) +> Merge Cond: (("outer".inv_nbr =3D "inner".inv_nbr) +> AND ("outer".inv_qfr =3D "inner".inv_qfr)) +> -> Index Scan using clmcom1_pkey on clmcom1 +> (cost=3D0.00..38645.61 rows=3D122488 width=3D267) (actual +> time=3D25.60..49142.16 rows=3D122494 loops=3D1) +> -> Index Scan using clmcom2_pkey on clmcom2 +> (cost=3D0.00..16004.08 rows=3D122488 width=3D92) (actual +> time=3D29.09..19418.94 rows=3D122494 loops=3D1) +> Total runtime: 80162.26 msec +> (9 rows) +> + +From pgsql-performance-owner@postgresql.org Wed Jul 27 15:28:47 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 54AD5529F9 + for ; + Wed, 27 Jul 2005 15:28:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28819-04 + for ; + Wed, 27 Jul 2005 18:28:44 +0000 (GMT) +Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) + by svr1.postgresql.org (Postfix) with SMTP id 011AA529EF + for ; + Wed, 27 Jul 2005 15:28:43 -0300 (ADT) +Received: (qmail 4263 invoked by uid 1112); 27 Jul 2005 18:28:44 -0000 +Date: Wed, 27 Jul 2005 13:28:44 -0500 (EST) +From: Kris Jurka +X-X-Sender: books@leary.csoft.net +To: Josh Berkus +Cc: pgsql-performance@postgresql.org, John A Meinel , + bizgres-general , + Dan Harris +Subject: Re: [Bizgres-general] Re: faster INSERT with possible +In-Reply-To: <200507270929.10251.josh@agliodbs.com> +Message-ID: +References: + <200507270929.10251.josh@agliodbs.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/418 +X-Sequence-Number: 13659 + + + +On Wed, 27 Jul 2005, Josh Berkus wrote: + +> b) you can't index a temp table. +> + +jurka# create temp table t (a int); +CREATE +jurka# create index myi on t(a); +CREATE + +From pgsql-performance-owner@postgresql.org Wed Jul 27 17:29:42 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B88D852C05; + Wed, 27 Jul 2005 17:27:15 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69426-06; Wed, 27 Jul 2005 20:27:12 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B97E52C11; + Wed, 27 Jul 2005 17:27:11 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7662106; Wed, 27 Jul 2005 13:29:26 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-hackers@postgresql.org +Subject: wal_buffer tests in +Date: Wed, 27 Jul 2005 13:30:01 -0700 +User-Agent: KMail/1.8 +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200507271330.02083.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/419 +X-Sequence-Number: 13660 + +Folks, + +I ran a wal_buffer test series. It appears that increasing the +wal_buffers is indeed very important for OLTP applications, potentially +resulting in as much as a 15% average increase in transaction processing. +What's interesting is that this is not just true for 8.1, it's true for +8.0.3 as well. + +More importantly, 8.1 performance is somehow back up to above-8.0 levels. +Something was broken in June that's got fixed (this test series is based +on July 3 CVS) but I don't know what. Clues? + +Test results are here: +http://pgfoundry.org/docman/view.php/1000041/79/wal_buffer_test.pdf + +As always, detailed test results are available from OSDL, just use: +http://khack.osdl.org/stp/# +where # is the test number. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Jul 27 18:21:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C2A5052C05 + for ; + Wed, 27 Jul 2005 18:21:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83233-02 + for ; + Wed, 27 Jul 2005 21:21:43 +0000 (GMT) +Received: from dd01.profihoster.net (dd01.profihoster.net [84.233.130.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 861BF52ADA + for ; + Wed, 27 Jul 2005 18:21:42 -0300 (ADT) +Received: from [192.168.54.33] (Iaec4.i.pppool.de [85.73.174.196]) + by dd01.profihoster.net (Postfix) with ESMTP id AF0C32383C3 + for ; + Wed, 27 Jul 2005 23:12:26 +0200 (CEST) +Message-ID: <42E7FAE3.7070604@laliluna.de> +Date: Wed, 27 Jul 2005 23:21:39 +0200 +From: Sebastian Hennebrueder +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: de-DE, de, en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Mirroring PostgreSQL database +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/420 +X-Sequence-Number: 13661 + +Shashi Kanth Boddula schrieb: + +> Hi, +> I have one customer who is using PostgreSQL 7.4.8 on Linux . He has +> some problems with database mirroring . The details are follows. +> The customer is using Linux on which PostgreSQL 7.4.8 along with Jboss +> 3.2.3 is running . He has 2 servers , one is acting as a live server +> (primary) and another is acting as a fail-over (secondary) server +> . Secondary server is placed in remote location . These servers are +> acting as a Attendence server for daily activities . Nearly 50,000 +> employees depend on the live server . +> +> The customer is using DBmirror tool to mirror the database records of +> primary to secondary . The customer is complaining that there is one +> day (24 hours) delay between primary and secondray for database +> synchronization . They have dedicated line and bandwidth , but still +> the problems exists. +> +> I just want to know , for immediate data mirroring , what is the best +> way for PostgreSQL . PostgreSQL is offering many mirror tools , but +> which one is the best ?. Is there any other way to accomplish the task ? +> +> Thank you . Waiting for your reply. +> +> +> Thanks & Regards, +> Shashi Kanth +> Consultant - Linux +> RHCE , LPIC-2 +> Onward Novell - Bangalore +> 9886455567 +> +> + +For java based solution you could also have a look at x-jdbc or xjdbc. + +But before you should find out what the reason for the delay is +actually. When the backup server is to slow, it may be not important which +mirroring tool you use. + + +-- +Best Regards / Viele Gr��e + +Sebastian Hennebrueder + +---- + +http://www.laliluna.de + +Tutorials for JSP, JavaServer Faces, Struts, Hibernate and EJB + +Get support, education and consulting for these technologies - uncomplicated and cheap. + + +From pgsql-performance-owner@postgresql.org Wed Jul 27 18:38:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A9F0252B06 + for ; + Wed, 27 Jul 2005 18:38:16 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 86196-02 + for ; + Wed, 27 Jul 2005 21:38:14 +0000 (GMT) +Received: from cmailg4.svr.pol.co.uk (cmailg4.svr.pol.co.uk [195.92.195.174]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B86D52A0B + for ; + Wed, 27 Jul 2005 18:38:13 -0300 (ADT) +Received: from modem-3758.llama.dialup.pol.co.uk ([217.135.190.174] + helo=192.168.0.102) by cmailg4.svr.pol.co.uk with esmtp (Exim 4.41) + id 1DxtbO-0004eR-Ni; Wed, 27 Jul 2005 22:38:11 +0100 +Subject: Re: [Bizgres-general] Re: faster INSERT with possible +From: Simon Riggs +To: Josh Berkus +Cc: pgsql-performance@postgresql.org, John A Meinel , + bizgres-general , + Dan Harris +In-Reply-To: <200507270929.10251.josh@agliodbs.com> +References: + <200507270929.10251.josh@agliodbs.com> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Wed, 27 Jul 2005 22:37:47 +0100 +Message-Id: <1122500267.3670.184.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/421 +X-Sequence-Number: 13662 + +On Wed, 2005-07-27 at 09:29 -0700, Josh Berkus wrote: +> Luke, +> +> > Well - now that I test it, it appears you are correct, temp table COPY +> > bypasses WAL - thanks for pointing it out! +> +> RIght. The problem is bypassing WAL for loading new "scratch" tables which +> aren't TEMPORARY tables. We need to do this for multi-threaded ETL, since: +> a) Temp tables can't be shared by several writers, and +> b) you can't index a temp table. + +The description of "scratch" tables might need some slight +clarification. It kindof makes it sound like temp tables. + +I had in mind the extra tables that an application sometimes needs to +operate faster. Denormalisations, pre-joined tables, pre-calculated +results, aggregated data. These are not temporary tables, just part of +the application - multi-user tables that stay across shutdown/restart. + +If you have gallons of GB, you will probably by looking to make use of +such tables. + +You can use such tables for the style of ETL known as ELT, but that is +not the only use. + +Best Regards, Simon Riggs + + +From pgsql-hackers-owner@postgresql.org Wed Jul 27 18:41:37 2005 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 03E1152BD6 + for ; + Wed, 27 Jul 2005 18:41:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84623-10 + for ; + Wed, 27 Jul 2005 21:41:31 +0000 (GMT) +Received: from smtp.osdl.org (smtp.osdl.org [65.172.181.4]) + by svr1.postgresql.org (Postfix) with ESMTP id A4B1E52ADA + for ; + Wed, 27 Jul 2005 18:41:24 -0300 (ADT) +Received: from lemming.pdx.osdl.net (fw.osdl.org [65.172.181.6]) + (authenticated bits=0) + by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j6RLfNjA026772 + (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); + Wed, 27 Jul 2005 14:41:23 -0700 +Message-Id: <200507272141.j6RLfNjA026772@smtp.osdl.org> +Date: Wed, 27 Jul 2005 14:42:01 -0700 +From: Mark Wong +To: josh@agliodbs.com +Cc: pgsql-hackers@postgresql.org +Subject: Re: wal_buffer tests in +In-Reply-To: <200507271330.02083.josh@agliodbs.com> +References: <200507271330.02083.josh@agliodbs.com> +Organization: OSDL +X-Mailer: Sylpheed-Claws 1.0.4a (GTK+ 1.2.10; x86_64-pc-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-MIMEDefang-Filter: osdl$Revision: 1.113 $ +X-Scanned-By: MIMEDefang 2.36 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/1010 +X-Sequence-Number: 71062 + +On Wed, 27 Jul 2005 13:30:01 -0700 +Josh Berkus wrote: + +> Folks, +> +> I ran a wal_buffer test series. It appears that increasing the +> wal_buffers is indeed very important for OLTP applications, potentially +> resulting in as much as a 15% average increase in transaction processing. +> What's interesting is that this is not just true for 8.1, it's true for +> 8.0.3 as well. +> +> More importantly, 8.1 performance is somehow back up to above-8.0 levels. +> Something was broken in June that's got fixed (this test series is based +> on July 3 CVS) but I don't know what. Clues? +> +> Test results are here: +> http://pgfoundry.org/docman/view.php/1000041/79/wal_buffer_test.pdf +> +> As always, detailed test results are available from OSDL, just use: +> http://khack.osdl.org/stp/# +> where # is the test number. + +The increase could actually be higher than 15% as 1800 notpm is about +the max throughput you can have with 150 warehouses with the default +thinktimes. The rule of thumb is about 12 * warehouses, for the +throughput. + +Mark + +From pgsql-performance-owner@postgresql.org Wed Jul 27 18:53:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C6BE45295A + for ; + Wed, 27 Jul 2005 18:53:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 86404-10 + for ; + Wed, 27 Jul 2005 21:52:53 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id D08F75293B + for ; + Wed, 27 Jul 2005 18:52:51 -0300 (ADT) +Received: (qmail 16473 invoked from network); 27 Jul 2005 23:52:57 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 27 Jul 2005 23:52:57 +0200 +To: "Simon Riggs" , + "Josh Berkus" +Cc: pgsql-performance@postgresql.org, + "John A Meinel" , + bizgres-general , + "Dan Harris" +Subject: Re: [Bizgres-general] Re: faster INSERT with possible +References: + <200507270929.10251.josh@agliodbs.com> + <1122500267.3670.184.camel@localhost.localdomain> +Message-ID: +Date: Wed, 27 Jul 2005 23:53:02 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <1122500267.3670.184.camel@localhost.localdomain> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/422 +X-Sequence-Number: 13663 + + + +> I had in mind the extra tables that an application sometimes needs to +> operate faster. Denormalisations, pre-joined tables, pre-calculated +> results, aggregated data. These are not temporary tables, just part of +> the application - multi-user tables that stay across shutdown/restart. + + You could also add caching search results for easy pagination without +redoing always entirely on each page the Big Slow Search Query that every +website has... + +From pgsql-hackers-owner@postgresql.org Wed Jul 27 19:01:52 2005 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E734A529A2 + for ; + Wed, 27 Jul 2005 19:01:23 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89107-08 + for ; + Wed, 27 Jul 2005 22:01:21 +0000 (GMT) +Received: from cmailm4.svr.pol.co.uk (cmailm4.svr.pol.co.uk [195.92.193.211]) + by svr1.postgresql.org (Postfix) with ESMTP id DED1E529E5 + for ; + Wed, 27 Jul 2005 19:01:20 -0300 (ADT) +Received: from modem-3758.llama.dialup.pol.co.uk ([217.135.190.174] + helo=192.168.0.102) by cmailm4.svr.pol.co.uk with esmtp (Exim 4.41) + id 1Dxtxo-0007AP-IV; Wed, 27 Jul 2005 23:01:20 +0100 +Subject: Re: wal_buffer tests in +From: Simon Riggs +To: josh@agliodbs.com +Cc: pgsql-hackers@postgresql.org +In-Reply-To: <200507271330.02083.josh@agliodbs.com> +References: <200507271330.02083.josh@agliodbs.com> +Content-Type: text/plain +Organization: 2nd Quadrant +Date: Wed, 27 Jul 2005 23:00:55 +0100 +Message-Id: <1122501655.3670.204.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/1012 +X-Sequence-Number: 71064 + +On Wed, 2005-07-27 at 13:30 -0700, Josh Berkus wrote: + +> I ran a wal_buffer test series. It appears that increasing the +> wal_buffers is indeed very important for OLTP applications, potentially +> resulting in as much as a 15% average increase in transaction processing. +> What's interesting is that this is not just true for 8.1, it's true for +> 8.0.3 as well. + +The most important thing about these tests is that for the first time we +have eliminated much of the post checkpoint noise-and-delay. + +Look at the response time charts between + +http://khack.osdl.org/stp/302959/results/0/rt.html + +and + +http://khack.osdl.org/stp/302963/results/0/rt.html + +This last set of results is a thing of beauty and I must congratulate +everybody involved for getting here after much effort. + +The graphs are smooth, which shows a balanced machine. I'd like to +repeat test 302963 with full_page_writes=false, to see if those response +time spikes at checkpoint drop down to normal level. + +I think these results are valid for large DW data loads also. + +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Wed Jul 27 19:35:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6C67952B75 + for ; + Wed, 27 Jul 2005 19:35:35 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97480-04 + for ; + Wed, 27 Jul 2005 22:35:26 +0000 (GMT) +Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) + by svr1.postgresql.org (Postfix) with ESMTP id D9577529A2 + for ; + Wed, 27 Jul 2005 19:35:24 -0300 (ADT) +Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net + [64.4.232.33]) (authenticated bits=0) + by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j6RMmUgr005676 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) + for ; Wed, 27 Jul 2005 14:48:31 -0800 +Message-ID: <42E80C28.2040608@aptalaska.net> +Date: Wed, 27 Jul 2005 14:35:20 -0800 +From: Matthew Schumacher +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Performance problems testing with Spamassassin 3.1.0 Bayes module. +X-Enigmail-Version: 0.91.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Spam-Bayes: Learn: ham +X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/423 +X-Sequence-Number: 13664 + +I'm not sure how much this has been discussed on the list, but wasn't +able to find anything relevant in the archives. + +The new Spamassassin is due out pretty soon. They are currently testing +3.1.0pre4. One of the things I hope to get out of this release is bayes +word stats moved to a real RDBMS. They have separated the mysql +BayesStore module from the PgSQL one so now postgres can use it's own +queries. + +I loaded all of this stuff up on a test server and am finding that the +bayes put performance is really not good enough for any real amount of +mail load. + +The performance problems seems to be when the bayes module is +inserting/updating. This is now handled by the token_put procedure. + +After playing with various indexes and what not I simply am unable to +make this procedure perform any better. Perhaps someone on the list can +spot the bottleneck and reveal why this procedure isn't performing that +well or ways to make it better. + +I put the rest of the schema up at +http://www.aptalaska.net/~matt.s/bayes/bayes_pg.sql in case someone +needs to see it too. + +CREATE OR REPLACE FUNCTION put_token(integer, bytea, integer, integer, +integer) RETURNS bool AS ' +DECLARE + inuserid ALIAS for $1; + intoken ALIAS for $2; + inspam_count ALIAS for $3; + inham_count ALIAS for $4; + inatime ALIAS for $5; + got_token record; + updated_atime_p bool; +BEGIN + updated_atime_p := FALSE; + SELECT INTO got_token spam_count, ham_count, atime + FROM bayes_token + WHERE id = inuserid + AND token = intoken; + IF NOT FOUND THEN + -- we do not insert negative counts, just return true + IF (inspam_count < 0 OR inham_count < 0) THEN + RETURN TRUE; + END IF; + INSERT INTO bayes_token (id, token, spam_count, ham_count, atime) + VALUES (inuserid, intoken, inspam_count, inham_count, inatime); + IF NOT FOUND THEN + RAISE EXCEPTION ''unable to insert into bayes_token''; + return FALSE; + END IF; + UPDATE bayes_vars SET token_count = token_count + 1 + WHERE id = inuserid; + IF NOT FOUND THEN + RAISE EXCEPTION ''unable to update token_count in bayes_vars''; + return FALSE; + END IF; + UPDATE bayes_vars SET newest_token_age = inatime + WHERE id = inuserid AND newest_token_age < inatime; + IF NOT FOUND THEN + UPDATE bayes_vars + SET oldest_token_age = inatime + WHERE id = inuserid + AND oldest_token_age > inatime; + END IF; + return TRUE; + ELSE + IF (inspam_count != 0) THEN + -- no need to update atime if it is < the existing value + IF (inatime < got_token.atime) THEN + UPDATE bayes_token + SET spam_count = spam_count + inspam_count + WHERE id = inuserid + AND token = intoken + AND spam_count + inspam_count >= 0; + ELSE + UPDATE bayes_token + SET spam_count = spam_count + inspam_count, + atime = inatime + WHERE id = inuserid + AND token = intoken + AND spam_count + inspam_count >= 0; + IF FOUND THEN + updated_atime_p := TRUE; + END IF; + END IF; + END IF; + IF (inham_count != 0) THEN + -- no need to update atime is < the existing value or if it was +already updated + IF inatime < got_token.atime OR updated_atime_p THEN + UPDATE bayes_token + SET ham_count = ham_count + inham_count + WHERE id = inuserid + AND token = intoken + AND ham_count + inham_count >= 0; + ELSE + UPDATE bayes_token + SET ham_count = ham_count + inham_count, + atime = inatime + WHERE id = inuserid + AND token = intoken + AND ham_count + inham_count >= 0; + IF FOUND THEN + updated_atime_p := TRUE; + END IF; + END IF; + END IF; + IF updated_atime_p THEN + UPDATE bayes_vars + SET oldest_token_age = inatime + WHERE id = inuserid + AND oldest_token_age > inatime; + END IF; + return TRUE; + END IF; +END; +' LANGUAGE 'plpgsql'; + + +From pgsql-performance-owner@postgresql.org Wed Jul 27 21:09:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C448452B4F + for ; + Wed, 27 Jul 2005 21:09:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13471-07 + for ; + Thu, 28 Jul 2005 00:09:24 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 5DD9E52A1C + for ; + Wed, 27 Jul 2005 21:09:23 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7662855; Wed, 27 Jul 2005 17:11:39 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 Bayes + module. +Date: Wed, 27 Jul 2005 17:12:15 -0700 +User-Agent: KMail/1.8 +Cc: Matthew Schumacher +References: <42E80C28.2040608@aptalaska.net> +In-Reply-To: <42E80C28.2040608@aptalaska.net> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +Message-Id: <200507271712.15299.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/424 +X-Sequence-Number: 13665 + +Matt, + +> After playing with various indexes and what not I simply am unable to +> make this procedure perform any better. =A0Perhaps someone on the list can +> spot the bottleneck and reveal why this procedure isn't performing that +> well or ways to make it better. + +Well, my first thought is that this is a pretty complicated procedure for=20 +something you want to peform well. Is all this logic really necessary? = +=20 +How does it get done for MySQL? + +=2D-=20 +=2D-Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Jul 27 21:41:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C10AE528CF + for ; + Wed, 27 Jul 2005 21:41:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74222-08 + for ; + Thu, 28 Jul 2005 00:41:23 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9106F528E4 + for ; + Wed, 27 Jul 2005 21:41:22 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6S0f5ge013605; + Wed, 27 Jul 2005 20:41:05 -0400 (EDT) +To: Josh Berkus +Cc: pgsql-performance@postgresql.org, + "Luke Lonergan" , + "Hannu Krosing" , + "John A Meinel" , + "Dan Harris" , + "bizgres-general" +Subject: Re: [Bizgres-general] Re: faster INSERT with possible +In-reply-to: <200507270929.10251.josh@agliodbs.com> +References: + <200507270929.10251.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Wed, 27 Jul 2005 09:29:09 -0700" +Date: Wed, 27 Jul 2005 20:41:05 -0400 +Message-ID: <13604.1122511265@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/425 +X-Sequence-Number: 13666 + +Josh Berkus writes: +> RIght. The problem is bypassing WAL for loading new "scratch" tables which +> aren't TEMPORARY tables. We need to do this for multi-threaded ETL, since: +> a) Temp tables can't be shared by several writers, and +> b) you can't index a temp table. + +This may not matter given point (a), but: point (b) is completely wrong. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jul 27 22:59:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9151A52956 + for ; + Wed, 27 Jul 2005 22:59:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93519-01 + for ; + Thu, 28 Jul 2005 01:59:41 +0000 (GMT) +Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 7F03F5293D + for ; + Wed, 27 Jul 2005 22:59:40 -0300 (ADT) +Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net + [64.4.232.33]) (authenticated bits=0) + by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j6S2CnoW013649 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); + Wed, 27 Jul 2005 18:12:49 -0800 +Message-ID: <42E83C09.2040508@aptalaska.net> +Date: Wed, 27 Jul 2005 17:59:37 -0800 +From: Matthew Schumacher +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: josh@agliodbs.com +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <42E80C28.2040608@aptalaska.net> + <200507271712.15299.josh@agliodbs.com> +In-Reply-To: <200507271712.15299.josh@agliodbs.com> +X-Enigmail-Version: 0.91.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Spam-Bayes: Learn: ham +X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/426 +X-Sequence-Number: 13667 + +Josh Berkus wrote: +> Matt, +> +> +>>After playing with various indexes and what not I simply am unable to +>>make this procedure perform any better. Perhaps someone on the list can +>>spot the bottleneck and reveal why this procedure isn't performing that +>>well or ways to make it better. +> +> +> Well, my first thought is that this is a pretty complicated procedure for +> something you want to peform well. Is all this logic really necessary? +> How does it get done for MySQL? +> + +I'm not sure if it's all needed, in mysql they have this simple schema: + +=============================================== +CREATE TABLE bayes_expire ( + id int(11) NOT NULL default '0', + runtime int(11) NOT NULL default '0', + KEY bayes_expire_idx1 (id) +) TYPE=MyISAM; + +CREATE TABLE bayes_global_vars ( + variable varchar(30) NOT NULL default '', + value varchar(200) NOT NULL default '', + PRIMARY KEY (variable) +) TYPE=MyISAM; + +INSERT INTO bayes_global_vars VALUES ('VERSION','3'); + +CREATE TABLE bayes_seen ( + id int(11) NOT NULL default '0', + msgid varchar(200) binary NOT NULL default '', + flag char(1) NOT NULL default '', + PRIMARY KEY (id,msgid) +) TYPE=MyISAM; + +CREATE TABLE bayes_token ( + id int(11) NOT NULL default '0', + token char(5) NOT NULL default '', + spam_count int(11) NOT NULL default '0', + ham_count int(11) NOT NULL default '0', + atime int(11) NOT NULL default '0', + PRIMARY KEY (id, token), + INDEX bayes_token_idx1 (token), + INDEX bayes_token_idx2 (id, atime) +) TYPE=MyISAM; + +CREATE TABLE bayes_vars ( + id int(11) NOT NULL AUTO_INCREMENT, + username varchar(200) NOT NULL default '', + spam_count int(11) NOT NULL default '0', + ham_count int(11) NOT NULL default '0', + token_count int(11) NOT NULL default '0', + last_expire int(11) NOT NULL default '0', + last_atime_delta int(11) NOT NULL default '0', + last_expire_reduce int(11) NOT NULL default '0', + oldest_token_age int(11) NOT NULL default '2147483647', + newest_token_age int(11) NOT NULL default '0', + PRIMARY KEY (id), + UNIQUE bayes_vars_idx1 (username) +) TYPE=MyISAM; +=============================================== + +Then they do this to insert the token: + +INSERT INTO bayes_token ( + id, + token, + spam_count, + ham_count, + atime +) VALUES ( + ?, + ?, + ?, + ?, + ? +) ON DUPLICATE KEY + UPDATE + spam_count = GREATEST(spam_count + ?, 0), + ham_count = GREATEST(ham_count + ?, 0), + atime = GREATEST(atime, ?) + +Or update the token: + +UPDATE bayes_vars SET + $token_count_update + newest_token_age = GREATEST(newest_token_age, ?), + oldest_token_age = LEAST(oldest_token_age, ?) + WHERE id = ? + + +I think the reason why the procedure was written for postgres was +because of the greatest and least statements performing poorly. + +Honestly, I'm not real up on writing procs, I was hoping the problem +would be obvious to someone. + +schu + +From pgsql-performance-owner@postgresql.org Wed Jul 27 23:11:56 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B519E52991 + for ; + Wed, 27 Jul 2005 23:11:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94603-03 + for ; + Thu, 28 Jul 2005 02:11:44 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 3119952998 + for ; + Wed, 27 Jul 2005 23:11:43 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7663255; Wed, 27 Jul 2005 19:14:01 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: Matthew Schumacher +Subject: Re: Performance problems testing with Spamassassin 3.1.0 Bayes + module. +Date: Wed, 27 Jul 2005 19:12:39 -0700 +User-Agent: KMail/1.8 +Cc: pgsql-performance@postgresql.org +References: <42E80C28.2040608@aptalaska.net> + <200507271712.15299.josh@agliodbs.com> + <42E83C09.2040508@aptalaska.net> +In-Reply-To: <42E83C09.2040508@aptalaska.net> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200507271912.39780.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/427 +X-Sequence-Number: 13668 + +Matt, + +> UPDATE bayes_vars SET +> $token_count_update +> newest_token_age = GREATEST(newest_token_age, ?), +> oldest_token_age = LEAST(oldest_token_age, ?) +> WHERE id = ? +> +> +> I think the reason why the procedure was written for postgres was +> because of the greatest and least statements performing poorly. + +Well, it might be because we don't have a built-in GREATEST or LEAST prior to +8.1. However, it's pretty darned easy to construct one. + +> Honestly, I'm not real up on writing procs, I was hoping the problem +> would be obvious to someone. + +Well, there's the general performance tuning stuff of course (postgresql.conf) +which if you've not done any of it will pretty dramatically affect your +througput rates. And vacuum, analyze, indexes, etc. + +You should also look at ways to make the SP simpler. For example, you have a +cycle that looks like: + +SELECT + IF NOT FOUND + INSERT + ELSE + UPDATE + +Which could be made shorter as: + +UPDATE + IF NOT FOUND + INSERT + +... saving you one index scan. + +Also, I don't quite follow it, but the procedure seems to be doing at least +two steps that the MySQL version isn't doing at all. If the PG version is +doing more things, of course it's going to take longer. + +Finally, when you have a proc you're happy with, I suggest having an expert +re-write it in C, which should double the procedure performance. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Jul 27 23:17:10 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4709052952 + for ; + Wed, 27 Jul 2005 23:17:08 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95222-07 + for ; + Thu, 28 Jul 2005 02:17:05 +0000 (GMT) +Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 6671752883 + for ; + Wed, 27 Jul 2005 23:17:05 -0300 (ADT) +Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net + [64.4.232.33]) (authenticated bits=0) + by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j6S2UHfr017334 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); + Wed, 27 Jul 2005 18:30:18 -0800 +Message-ID: <42E84021.9040904@aptalaska.net> +Date: Wed, 27 Jul 2005 18:17:05 -0800 +From: Matthew Schumacher +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Josh Berkus +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <42E80C28.2040608@aptalaska.net> + <200507271712.15299.josh@agliodbs.com> + <42E83C09.2040508@aptalaska.net> + <200507271912.39780.josh@agliodbs.com> +In-Reply-To: <200507271912.39780.josh@agliodbs.com> +X-Enigmail-Version: 0.91.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Spam-Bayes: Learn: unavailable +X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/428 +X-Sequence-Number: 13669 + +Josh Berkus wrote: +> Matt, +> + +> Well, it might be because we don't have a built-in GREATEST or LEAST prior to +> 8.1. However, it's pretty darned easy to construct one. + +I was more talking about min() and max() but yea, I think you knew where +I was going with it... + +> +> Well, there's the general performance tuning stuff of course (postgresql.conf) +> which if you've not done any of it will pretty dramatically affect your +> througput rates. And vacuum, analyze, indexes, etc. + +I have gone though all that. + +> You should also look at ways to make the SP simpler. For example, you have a +> cycle that looks like: +> +> SELECT +> IF NOT FOUND +> INSERT +> ELSE +> UPDATE +> +> Which could be made shorter as: +> +> UPDATE +> IF NOT FOUND +> INSERT +> +> ... saving you one index scan. +> +> Also, I don't quite follow it, but the procedure seems to be doing at least +> two steps that the MySQL version isn't doing at all. If the PG version is +> doing more things, of course it's going to take longer. +> +> Finally, when you have a proc you're happy with, I suggest having an expert +> re-write it in C, which should double the procedure performance. +> + +Sounds like I need to completely understand what the proc is doing and +work on a rewrite. I'll look into writing it in C, I need to do some +reading about how that works and exactly what it buys you. + +Thanks for the helpful comments. + +schu + +From pgsql-performance-owner@postgresql.org Thu Jul 28 02:16:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 83EDB52933 + for ; + Thu, 28 Jul 2005 02:16:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42644-03 + for ; + Thu, 28 Jul 2005 05:15:56 +0000 (GMT) +Received: from mail.travelamericas.com (unknown [206.130.134.147]) + by svr1.postgresql.org (Postfix) with SMTP id DD32B52903 + for ; + Thu, 28 Jul 2005 02:15:55 -0300 (ADT) +Received: (qmail 28370 invoked from network); 28 Jul 2005 05:15:55 -0000 +Received: from unknown (HELO ?10.0.0.253?) (10.0.0.253) + by verkiel.travelamericas.com with SMTP; 28 Jul 2005 05:15:55 -0000 +Message-ID: <42E86A03.1070803@travelamericas.com> +Date: Wed, 27 Jul 2005 22:15:47 -0700 +From: Chris Travers +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Left joining against two empty tables makes a query SLOW +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/429 +X-Sequence-Number: 13670 + +Hi all; + +I have a customer who currently uses an application which had become +slow. After doing some digging, I found the slow query: + +SELECT c.accno, c.description, c.link, c.category, ac.project_id, +p.projectnumber, + a.department_id, d.description AS department +FROM chart c JOIN acc_trans ac ON (ac.chart_id = c.id) + JOIN ar a ON (a.id = ac.trans_id) + LEFT JOIN project p ON (ac.project_id = p.id) + LEFT JOIN department d ON (d.id = a.department_id) +WHERE a.customer_id = 11373 AND a.id IN ( + SELECT max(id) FROM ar WHERE customer_id = 11373 +); + +(reformatted for readability) + +This is taking 10 seconds to run. + +Interestingly, both the project and department tables are blank, and if +I omit them, the query becomes: +SELECT c.accno, c.description, c.link, c.category, ac.project_id +FROM chart c JOIN acc_trans ac ON (ac.chart_id = c.id) + JOIN ar a ON (a.id = ac.trans_id) +WHERE a.customer_id = 11373 AND a.id IN ( + SELECT max(id) FROM ar WHERE customer_id = 11373 +); + +This takes 139ms. 1% of the previous query. + +The plan for the long query is: + + +QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------- + Hash IN Join (cost=87337.25..106344.93 rows=41 width=118) (actual +time=7615.843..9850.209 rows=10 loops=1) + Hash Cond: ("outer".trans_id = "inner".max) + -> Merge Right Join (cost=86620.57..100889.85 rows=947598 +width=126) (actual time=7408.830..9200.435 rows=177769 loops=1) + Merge Cond: ("outer".id = "inner".department_id) + -> Index Scan using department_id_key on department d +(cost=0.00..52.66 +rows=1060 width=36) (actual time=0.090..0.090 rows=0 loops=1) + -> Sort (cost=86620.57..87067.55 rows=178792 width=94) +(actual time=7408.709..7925.843 rows=177769 loops=1) + Sort Key: a.department_id + -> Merge Right Join (cost=45871.18..46952.83 +rows=178792 width=94) (actual time=4962.122..6671.319 rows=177769 loops=1) + Merge Cond: ("outer".id = "inner".project_id) + -> Index Scan using project_id_key on project p +(cost=0.00..49.80 rows=800 width=36) (actual time=0.007..0.007 rows=0 +loops=1) + -> Sort (cost=45871.18..46318.16 rows=178792 +width=62) (actual time=4962.084..5475.636 rows=177769 loops=1) + Sort Key: ac.project_id + -> Hash Join (cost=821.20..13193.43 +rows=178792 width=62) (actual time=174.905..4295.685 rows=177769 loops=1) + Hash Cond: ("outer".chart_id = "inner".id) + -> Hash Join (cost=817.66..10508.02 +rows=178791 +width=20) (actual time=173.952..2840.824 rows=177769 loops=1) + Hash Cond: ("outer".trans_id = +"inner".id) + -> Seq Scan on acc_trans ac +(cost=0.00..3304.38 rows=181538 width=12) (actual time=0.062..537.753 +rows=181322 loops=1) + -> Hash (cost=659.55..659.55 +rows=22844 width=8) (actual time=173.625..173.625 rows=0 loops=1) + -> Seq Scan on ar a +(cost=0.00..659.55 rows=22844 width=8) (actual time=0.022..101.828 +rows=22844 loops=1) + Filter: (customer_id += 11373) + -> Hash (cost=3.23..3.23 rows=123 +width=50) (actual time=0.915..0.915 rows=0 loops=1) + -> Seq Scan on chart c +(cost=0.00..3.23 rows=123 width=50) (actual time=0.013..0.528 rows=123 +loops=1) + -> Hash (cost=716.67..716.67 rows=1 width=4) (actual +time=129.037..129.037 rows=0 loops=1) + -> Subquery Scan "IN_subquery" (cost=716.66..716.67 rows=1 +width=4) (actual time=129.017..129.025 rows=1 loops=1) + -> Aggregate (cost=716.66..716.66 rows=1 width=4) +(actual time=129.008..129.011 rows=1 loops=1) + -> Seq Scan on ar (cost=0.00..659.55 rows=22844 +width=4) (actual time=0.020..73.266 rows=22844 loops=1) + Filter: (customer_id = 11373) + Total runtime: 9954.133 ms +(28 rows) + +The shorter query's plan is: + + +QUERY PLAN + +--------------------------------------------------------------------------------------------------------------------------------------------------------- + Hash Join (cost=728.42..732.96 rows=8 width=50) (actual +time=130.908..131.593 rows=10 loops=1) + Hash Cond: ("outer".id = "inner".chart_id) + -> Seq Scan on chart c (cost=0.00..3.23 rows=123 width=50) (actual +time=0.006..0.361 rows=123 loops=1) + -> Hash (cost=728.40..728.40 rows=8 width=8) (actual +time=130.841..130.841 rows=0 loops=1) + -> Nested Loop (cost=716.67..728.40 rows=8 width=8) (actual +time=130.692..130.805 rows=10 loops=1) + -> Nested Loop (cost=716.67..720.89 rows=1 width=8) +(actual time=130.626..130.639 rows=1 loops=1) + -> HashAggregate (cost=716.67..716.67 rows=1 +width=4) (actual time=130.484..130.487 rows=1 loops=1) + -> Subquery Scan "IN_subquery" +(cost=716.66..716.67 rows=1 width=4) (actual time=130.455..130.464 +rows=1 loops=1) + -> Aggregate (cost=716.66..716.66 +rows=1 width=4) (actual time=130.445..130.448 rows=1 loops=1) + -> Seq Scan on ar +(cost=0.00..659.55 rows=22844 width=4) (actual time=0.020..74.174 +rows=22844 loops=1) + Filter: (customer_id = 11373) + -> Index Scan using ar_id_key on ar a +(cost=0.00..4.20 rows=1 width=4) (actual time=0.122..0.125 rows=1 loops=1) + Index Cond: (a.id = "outer".max) + Filter: (customer_id = 11373) + -> Index Scan using acc_trans_trans_id_key on acc_trans +ac (cost=0.00..7.41 rows=8 width=12) (actual time=0.051..0.097 rows=10 +loops=1) + Index Cond: ("outer".max = ac.trans_id) + Total runtime: 131.879 ms +(17 rows) + +I am not sure if I want to remove support for the other two tables +yet. However, I wanted to submit this here as a (possibly corner-) +case where the plan seems to be far slower than it needs to be. + +Best Wishes, +Chris Travers +Metatron Technology Consulting + +From pgsql-performance-owner@postgresql.org Thu Jul 28 03:19:37 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2FFBC52DEA + for ; + Thu, 28 Jul 2005 03:19:31 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51825-10 + for ; + Thu, 28 Jul 2005 06:19:25 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C0BA552CB6 + for ; + Thu, 28 Jul 2005 03:19:24 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6S6JJXp020876; + Thu, 28 Jul 2005 02:19:19 -0400 (EDT) +To: Matthew Schumacher +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 Bayes + module. +In-reply-to: <42E80C28.2040608@aptalaska.net> +References: <42E80C28.2040608@aptalaska.net> +Comments: In-reply-to Matthew Schumacher + message dated "Wed, 27 Jul 2005 14:35:20 -0800" +Date: Thu, 28 Jul 2005 02:19:19 -0400 +Message-ID: <20875.1122531559@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/430 +X-Sequence-Number: 13671 + +Matthew Schumacher writes: +> After playing with various indexes and what not I simply am unable to +> make this procedure perform any better. Perhaps someone on the list can +> spot the bottleneck and reveal why this procedure isn't performing that +> well or ways to make it better. + +There's not anything obviously wrong with that procedure --- all of the +updates are on primary keys, so one would expect reasonably efficient +query plans to get chosen. Perhaps it'd be worth the trouble to build +the server with profiling enabled and get a gprof trace to see where the +time is going. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 28 03:29:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 644D152C7C + for ; + Thu, 28 Jul 2005 03:29:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57685-03 + for ; + Thu, 28 Jul 2005 06:29:25 +0000 (GMT) +Received: from veggie-fuel.com (veggie-fuel.com [200.46.208.238]) + by svr1.postgresql.org (Postfix) with ESMTP id 5FD8C5295A + for ; + Thu, 28 Jul 2005 03:29:24 -0300 (ADT) +Received: from localhost (unknown [200.46.204.144]) + by veggie-fuel.com (Postfix) with ESMTP id AE18D35F9DE + for ; + Thu, 28 Jul 2005 06:29:25 +0000 (GMT) +Received: from veggie-fuel.com ([200.46.208.238]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56636-05; Thu, 28 Jul 2005 06:29:16 +0000 (GMT) +Received: from [10.0.0.7] (63-228-143-68.phnx.qwest.net [63.228.143.68]) + by veggie-fuel.com (Postfix) with ESMTP id F348335F9D6; + Thu, 28 Jul 2005 06:28:49 +0000 (GMT) +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +From: Karim Nassar +To: Matthew Schumacher +Cc: pgsql-performance@postgresql.org +In-Reply-To: <42E80C28.2040608@aptalaska.net> +References: <42E80C28.2040608@aptalaska.net> +Content-Type: text/plain +Date: Wed, 27 Jul 2005 23:27:03 -0700 +Message-Id: <1122532023.25574.1.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.069 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/431 +X-Sequence-Number: 13672 + +On Wed, 2005-07-27 at 14:35 -0800, Matthew Schumacher wrote: + +> I put the rest of the schema up at +> http://www.aptalaska.net/~matt.s/bayes/bayes_pg.sql in case someone +> needs to see it too. + +Do you have sample data too? + +-- +Karim Nassar +Collaborative Computing Lab of NAU +Office: (928) 523 5868 -=- Mobile: (928) 699 9221 +http://ccl.cens.nau.edu/~kan4 + + +From pgsql-performance-owner@postgresql.org Thu Jul 28 06:22:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3145152801 + for ; + Thu, 28 Jul 2005 06:22:45 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96024-01 + for ; + Thu, 28 Jul 2005 09:22:39 +0000 (GMT) +Received: from purple.bdb.fi (purple.bdb.fi [195.197.212.62]) + by svr1.postgresql.org (Postfix) with ESMTP id BAD0D5288B + for ; + Thu, 28 Jul 2005 06:22:35 -0300 (ADT) +Received: by purple.bdb.fi (Postfix, from userid 101) + id D691C1C83; Thu, 28 Jul 2005 12:21:12 +0300 (EETDST) +Received: from localhost (localhost [127.0.0.1]) + by purple.bdb.fi (Postfix) with ESMTP id D359C4A95 + for ; + Thu, 28 Jul 2005 12:21:12 +0300 (EETDST) +Date: Thu, 28 Jul 2005 12:21:12 +0300 (EETDST) +From: Kari Lavikka +To: pgsql-performance@postgresql.org +Subject: Finding bottleneck +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/432 +X-Sequence-Number: 13673 + +Hello, + +we recently upgraded our dual Xeon Dell to a brand new Sun v40z with 4 +opterons, 16GB of memory and MegaRAID with enough disks. OS is Debian +Sarge amd64, PostgreSQL is 8.0.3. Size of database is something like 80GB +and our website performs about 600 selects and several updates/inserts a +second. + +v40z performs somewhat better than our old Dell but mostly due to +increased amount of memory. The problem is.. there seems to by plenty of +free CPU available and almost no IO-wait but CPU bound queries seem to +linger for some reason. Problem appears very clearly during checkpointing. +Queries accumulate and when checkpointing is over, there can be something +like 400 queries running but over 50% of cpu is just idling. + +procs -----------memory------------ ---swap-- -----io---- --system-- ----cpu---- + r b swpd free buff cache si so bi bo in cs us sy id wa + 3 1 0 494008 159492 14107180 0 0 919 3164 3176 13031 29 12 52 8 + 5 3 0 477508 159508 14118452 0 0 1071 4479 3474 13298 27 13 47 13 + 0 0 0 463604 159532 14128832 0 0 922 2903 3352 12627 29 11 52 8 + 3 1 0 442260 159616 14141668 0 0 1208 3153 3357 13163 28 12 52 9 + +An example of a lingering query (there's usually several of these or similar): + +SELECT u.uid, u.nick, u.name, u.showname, i.status, i.stamp, i.image_id, +i.info, i.t_width, i.t_height FROM users u INNER JOIN image i ON i.uid = +u.uid INNER JOIN user_online uo ON u.uid = uo.uid WHERE u.city_id = 5 AND +i.status = 'd' AND u.status = 'a' ORDER BY city_id, upper(u.nick) LIMIT +(40 + 1) OFFSET 320 + +Tables involved contain no more than 4 million rows. Those are constantly +accessed and should fit nicely to cache. But database is just slow because +of some unknown reason. Any ideas? + +----------------->8 Relevant rows from postgresql.conf 8<----------------- + +shared_buffers = 15000 # min 16, at least max_connections*2, 8KB each +work_mem = 1536 # min 64, size in KB +maintenance_work_mem = 32768 # min 1024, size in KB + +max_fsm_pages = 1000000 # min max_fsm_relations*16, 6 bytes each +max_fsm_relations = 5000 # min 100, ~50 bytes each + +vacuum_cost_delay = 15 # 0-1000 milliseconds +vacuum_cost_limit = 120 # 0-10000 credits + +bgwriter_percent = 2 # 0-100% of dirty buffers in each round + +fsync = true # turns forced synchronization on or off + # fsync, fdatasync, open_sync, or open_datasync +wal_buffers = 128 # min 4, 8KB each +commit_delay = 80000 # range 0-100000, in microseconds +commit_siblings = 10 # range 1-1000 + +checkpoint_segments = 200 # in logfile segments, min 1, 16MB each +checkpoint_timeout = 1800 # range 30-3600, in seconds + +effective_cache_size = 1000000 # typically 8KB each +random_page_cost = 1.8 # units are one sequential page fetch cost + +default_statistics_target = 150 # range 1-1000 + +stats_start_collector = true +stats_command_string = true + + |\__/| + ( oo ) Kari Lavikka - tuner@bdb.fi - (050) 380 3808 +__ooO( )Ooo_______ _____ ___ _ _ _ _ _ _ _ + "" + +From pgsql-performance-owner@postgresql.org Thu Jul 28 06:35:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A856F529E2 + for ; + Thu, 28 Jul 2005 06:35:02 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 98894-02 + for ; + Thu, 28 Jul 2005 09:34:55 +0000 (GMT) +Received: from linuxworld.com.au (unknown [203.34.46.50]) + by svr1.postgresql.org (Postfix) with ESMTP id 67036529C8 + for ; + Thu, 28 Jul 2005 06:34:53 -0300 (ADT) +Received: from linuxworld.com.au (IDENT:swm@localhost.localdomain [127.0.0.1]) + by linuxworld.com.au (8.13.2/8.13.2) with ESMTP id j6S9Yoti002779; + Thu, 28 Jul 2005 19:34:50 +1000 +Received: from localhost (swm@localhost) + by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id + j6S9Yorh002776; Thu, 28 Jul 2005 19:34:50 +1000 +X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs +Date: Thu, 28 Jul 2005 19:34:50 +1000 (EST) +From: Gavin Sherry +X-X-Sender: swm@linuxworld.com.au +To: Kari Lavikka +Cc: pgsql-performance@postgresql.org +Subject: Re: Finding bottleneck +In-Reply-To: +Message-ID: +References: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/433 +X-Sequence-Number: 13674 + +Hi, + +On Thu, 28 Jul 2005, Kari Lavikka wrote: + +> ----------------->8 Relevant rows from postgresql.conf 8<----------------- +> +> shared_buffers = 15000 # min 16, at least max_connections*2, 8KB each +> work_mem = 1536 # min 64, size in KB + +As an aside, I'd increase work_mem -- but it doesn't sound like that is +your problem. + +> maintenance_work_mem = 32768 # min 1024, size in KB +> +> max_fsm_pages = 1000000 # min max_fsm_relations*16, 6 bytes each +> max_fsm_relations = 5000 # min 100, ~50 bytes each +> +> vacuum_cost_delay = 15 # 0-1000 milliseconds +> vacuum_cost_limit = 120 # 0-10000 credits +> +> bgwriter_percent = 2 # 0-100% of dirty buffers in each round +> +> fsync = true # turns forced synchronization on or off +> # fsync, fdatasync, open_sync, or open_datasync +> wal_buffers = 128 # min 4, 8KB each + +Some benchmarking results out today suggest that wal_buffers = 1024 or +even 2048 could greatly assist you. + +> commit_delay = 80000 # range 0-100000, in microseconds +> commit_siblings = 10 # range 1-1000 + +This may explain the fact that you've got backed up queries and idle CPU +-- I'm not certain though. What does disabling commit_delay do to your +situation? + +Gavin + +From pgsql-performance-owner@postgresql.org Thu Jul 28 06:56:09 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 412BA529E0 + for ; + Thu, 28 Jul 2005 06:56:03 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02860-03 + for ; + Thu, 28 Jul 2005 09:55:56 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.199]) + by svr1.postgresql.org (Postfix) with ESMTP id 9A57B52889 + for ; + Thu, 28 Jul 2005 06:55:54 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id z6so202716nzd + for ; + Thu, 28 Jul 2005 02:55:57 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=dkjgoMwUIRku+QtJaAV2+p+gSttSePVx6tx8DBH/SuKSibIANggYvZuulnkq6LyBs/qP399dTPHVtItQfrxKUO4yANADQVz7AUdLQFUacbYksUyRUpSJomQA4Gf2mB7Jq7JLCapnnj/c8oPuV4ZmwcZi+FWa1lcDDDm5T7oRv0k= +Received: by 10.37.22.50 with SMTP id z50mr912833nzi; + Thu, 28 Jul 2005 02:55:57 -0700 (PDT) +Received: by 10.36.119.19 with HTTP; Thu, 28 Jul 2005 02:55:57 -0700 (PDT) +Message-ID: +Date: Thu, 28 Jul 2005 15:25:57 +0530 +From: Gnanavel S +Reply-To: Gnanavel S +To: Chris Travers +Subject: Re: Left joining against two empty tables makes a query SLOW +Cc: pgsql-performance@postgresql.org +In-Reply-To: <42E86A03.1070803@travelamericas.com> +Mime-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_2293_14846395.1122544557125" +References: <42E86A03.1070803@travelamericas.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.488 tagged_above=0 required=5 tests=AWL, HTML_50_60, + HTML_MESSAGE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/434 +X-Sequence-Number: 13675 + +------=_Part_2293_14846395.1122544557125 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +On 7/28/05, Chris Travers wrote: +>=20 +> Hi all; +>=20 +> I have a customer who currently uses an application which had become +> slow. After doing some digging, I found the slow query: +>=20 +> SELECT c.accno, c.description, c.link, c.category, ac.project_id, +> p.projectnumber, +> a.department_id, d.description AS department +> FROM chart c JOIN acc_trans ac ON (ac.chart_id =3D c.id ) +> JOIN ar a ON (a.id =3D ac.trans_id) +> LEFT JOIN project p ON (ac.project_id =3D p.id ) +> LEFT JOIN department d ON (d.id =3D a.department_id) +> WHERE a.customer_id =3D 11373 AND a.id IN ( +> SELECT max(id) FROM ar WHERE customer_id =3D 11373 +> ); +>=20 +> (reformatted for readability) +>=20 +> This is taking 10 seconds to run. +>=20 +> Interestingly, both the project and department tables are blank, and if +> I omit them, the query becomes: +> SELECT c.accno, c.description, c.link, c.category, ac.project_id +> FROM chart c JOIN acc_trans ac ON (ac.chart_id =3D c.id ) +> JOIN ar a ON (a.id =3D ac.trans_id) +> WHERE a.customer_id =3D 11373 AND a.id IN ( +> SELECT max(id) FROM ar WHERE customer_id =3D 11373 +> ); +>=20 +> This takes 139ms. 1% of the previous query. +>=20 +> The plan for the long query is: +>=20 +>=20 +> QUERY PLAN +>=20 +> -------------------------------------------------------------------------= +---------------------------------------------------------------------------= +------------ +> Hash IN Join (cost=3D87337.25..106344.93 rows=3D41 width=3D118) (actual +> time=3D7615.843..9850.209 rows=3D10 loops=3D1) +> Hash Cond: ("outer".trans_id =3D "inner".max) +> -> Merge Right Join (cost=3D86620.57..100889.85 rows=3D947598 +> width=3D126) (actual time=3D7408.830..9200.435 rows=3D177769 loops=3D1) +> Merge Cond: ("outer".id =3D "inner".department_id) +> -> Index Scan using department_id_key on department d +> (cost=3D0.00..52.66 +> rows=3D1060 width=3D36) (actual time=3D0.090..0.090 rows=3D0 loops=3D1) + + +vacuum & reindex the department and project table as the planner expects=20 +there are 1060 rows but actually returning nothing. + +-> Sort (cost=3D86620.57..87067.55 rows=3D178792 width=3D94) +> (actual time=3D7408.709..7925.843 rows=3D177769 loops=3D1) +> Sort Key: a.department_id +> -> Merge Right Join (cost=3D45871.18..46952.83 +> rows=3D178792 width=3D94) (actual time=3D4962.122..6671.319 rows=3D177769= + loops=3D1) +> Merge Cond: ("outer".id =3D "inner".project_id) +> -> Index Scan using project_id_key on project p +> (cost=3D0.00..49.80 rows=3D800 width=3D36) (actual time=3D0.007..0.007 ro= +ws=3D0 +> loops=3D1) +> -> Sort (cost=3D45871.18..46318.16 rows=3D178792 +> width=3D62) (actual time=3D4962.084..5475.636 rows=3D177769 loops=3D1) +> Sort Key: ac.project_id +> -> Hash Join (cost=3D821.20..13193.43 +> rows=3D178792 width=3D62) (actual time=3D174.905..4295.685 rows=3D177769 = +loops=3D1) +> Hash Cond: ("outer".chart_id =3D "inner".id) +> -> Hash Join (cost=3D817.66..10508.02 +> rows=3D178791 +> width=3D20) (actual time=3D173.952..2840.824 rows=3D177769 loops=3D1) +> Hash Cond: ("outer".trans_id =3D +> "inner".id) +> -> Seq Scan on acc_trans ac +> (cost=3D0.00..3304.38 rows=3D181538 width=3D12) (actual time=3D0.062..537= +.753 +> rows=3D181322 loops=3D1) +> -> Hash (cost=3D659.55..659.55 +> rows=3D22844 width=3D8) (actual time=3D173.625..173.625 rows=3D0 loops=3D= +1) +> -> Seq Scan on ar a +> (cost=3D0.00..659.55 rows=3D22844 width=3D8) (actual time=3D0.022..101.82= +8 +> rows=3D22844 loops=3D1) +> Filter: (customer_id +> =3D 11373) +> -> Hash (cost=3D3.23..3.23 rows=3D123 +> width=3D50) (actual time=3D0.915..0.915 rows=3D0 loops=3D1) +> -> Seq Scan on chart c +> (cost=3D0.00..3.23 rows=3D123 width=3D50) (actual time=3D0.013..0.528 row= +s=3D123 +> loops=3D1) +> -> Hash (cost=3D716.67..716.67 rows=3D1 width=3D4) (actual +> time=3D129.037..129.037 rows=3D0 loops=3D1) +> -> Subquery Scan "IN_subquery" (cost=3D716.66..716.67 rows=3D1 +> width=3D4) (actual time=3D129.017..129.025 rows=3D1 loops=3D1) +> -> Aggregate (cost=3D716.66..716.66 rows=3D1 width=3D4) +> (actual time=3D129.008..129.011 rows=3D1 loops=3D1) +> -> Seq Scan on ar (cost=3D0.00..659.55 rows=3D22844 +> width=3D4) (actual time=3D0.020..73.266 rows=3D22844 loops=3D1) +> Filter: (customer_id =3D 11373) +> Total runtime: 9954.133 ms +> (28 rows) +>=20 +> The shorter query's plan is: +>=20 +>=20 +> QUERY PLAN +>=20 +>=20 +> -------------------------------------------------------------------------= +---------------------------------------------------------------------------= +----- +> Hash Join (cost=3D728.42..732.96 rows=3D8 width=3D50) (actual +> time=3D130.908..131.593 rows=3D10 loops=3D1) +> Hash Cond: ("outer".id =3D "inner".chart_id) +> -> Seq Scan on chart c (cost=3D0.00..3.23 rows=3D123 width=3D50) (actual +> time=3D0.006..0.361 rows=3D123 loops=3D1) +> -> Hash (cost=3D728.40..728.40 rows=3D8 width=3D8) (actual +> time=3D130.841..130.841 rows=3D0 loops=3D1) +> -> Nested Loop (cost=3D716.67..728.40 rows=3D8 width=3D8) (actual +> time=3D130.692..130.805 rows=3D10 loops=3D1) +> -> Nested Loop (cost=3D716.67..720.89 rows=3D1 width=3D8) +> (actual time=3D130.626..130.639 rows=3D1 loops=3D1) +> -> HashAggregate (cost=3D716.67..716.67 rows=3D1 +> width=3D4) (actual time=3D130.484..130.487 rows=3D1 loops=3D1) +> -> Subquery Scan "IN_subquery" +> (cost=3D716.66..716.67 rows=3D1 width=3D4) (actual time=3D130.455..130.46= +4 +> rows=3D1 loops=3D1) +> -> Aggregate (cost=3D716.66..716.66 +> rows=3D1 width=3D4) (actual time=3D130.445..130.448 rows=3D1 loops=3D1) +> -> Seq Scan on ar +> (cost=3D0.00..659.55 rows=3D22844 width=3D4) (actual time=3D0.020..74.174 +> rows=3D22844 loops=3D1) +> Filter: (customer_id =3D 11373) +> -> Index Scan using ar_id_key on ar a +> (cost=3D0.00..4.20 rows=3D1 width=3D4) (actual time=3D0.122..0.125 rows= +=3D1 loops=3D1) +> Index Cond: (a.id =3D "outer".max) +> Filter: (customer_id =3D 11373) +> -> Index Scan using acc_trans_trans_id_key on acc_trans +> ac (cost=3D0.00..7.41 rows=3D8 width=3D12) (actual time=3D0.051..0.097 ro= +ws=3D10 +> loops=3D1) +> Index Cond: ("outer".max =3D ac.trans_id) +> Total runtime: 131.879 ms +> (17 rows) +>=20 +> I am not sure if I want to remove support for the other two tables +> yet. However, I wanted to submit this here as a (possibly corner-) +> case where the plan seems to be far slower than it needs to be. +>=20 +> Best Wishes, +> Chris Travers +> Metatron Technology Consulting +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend +>=20 + + + +--=20 +with regards, +S.Gnanavel +Satyam Computer Services Ltd. + +------=_Part_2293_14846395.1122544557125 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +

On 7/28/05, Chris Travers <c= +hris@travelamericas.com> wrote:
+Hi all;

I have a customer who currently uses an application which ha= +d become
slow.  After doing some digging, I found the slow que= +ry:

SELECT c.accno, c.description, c.link, c.category, ac.project_id= +,
p.projectnumber +,
        a.department_id, d.des= +cription AS department
FROM chart c JOIN acc_trans ac ON (ac.chart_id = +=3D c.id)
     &nbs= +p;  JOIN ar a ON (a.id =3D ac.trans_i= +d)
        LEFT JOIN project p O= +N ( +ac.project_id =3D p.id)
   &n= +bsp;    LEFT JOIN department d ON (d.id =3D a.department_id)
WHERE a.customer_id =3D 11373 AND a.id IN (
      &n= +bsp; SELECT max(id) FROM ar WHERE customer_id =3D 11373 +
);

(reformatted for readability)

This is taking 10 second= +s to run.

Interestingly, both the project and department tables are = +blank, and if
I omit them, the query becomes:
SELECT c.accno, c.descr= +iption +, c.link, c.category, ac.project_id
FROM chart c JOIN acc_trans ac ON (a= +c.chart_id =3D c.id)
    = +;    JOIN ar a ON (a.id =3D= + ac.trans_id)
WHERE a.customer_id =3D 11373 AND=20 +a.id IN (
     &nbs= +p;  SELECT max(id) FROM ar WHERE customer_id =3D 11373
);
<= +br>This takes 139ms.  1% of the previous query.

The plan f= +or the long query is:


QUERY PLAN
----------------------------= +---------------------------------------------------------------------------= +--------------------------------------------------------- +
Hash IN Join  (cost=3D87337.25..106344.93 rows=3D41 width=3D= +118) (actual
time=3D7615.843..9850.209 rows=3D10 loops=3D1)
 &nb= +sp; Hash Cond: ("outer".trans_id =3D "inner".max)
&n= +bsp;  ->  Merge Right Join  (cost=3D +86620.57..100889.85 rows=3D947598
width=3D126) (actual time=3D7408.830..= +9200.435 rows=3D177769 loops=3D1)
      &n= +bsp;  Merge Cond: ("outer".id =3D "inner".departme= +nt_id)
         ->  = +;Index Scan using department_id_key on department d +
(cost=3D0.00..52.66
rows=3D1060 width=3D36) (actual time=3D0.090..0.= +090 rows=3D0 loops=3D1)

+vacuum & reindex the department and project table as the planner expect= +s there are 1060 rows but actually returning nothing.
+

 &= +nbsp;       ->  Sort  = +(cost=3D86620.57..87067.55 rows=3D178792 width=3D94)
(actual time=3D +7408.709..7925.843 rows=3D177769 loops=3D1)
    &nbs= +p;          Sort Key: a.depart= +ment_id
          &nbs= +p;    +->  Merge Right Join  (cost=3D45871.18..46952.83
= +rows=3D178792 width=3D94) (actual time=3D4962.122..6671.319 rows=3D177769 l= +oops=3D1)
          &n= +bsp;          +Merge Cond: ("outer".id =3D "inner".project_id)
&nbs= +p;            &= +nbsp;       +->  Index Scan using project_id_key on project p
(cost=3D0.= +00..49.80 rows=3D800 width=3D36) (actual time=3D0.007..0.007 rows=3D0
lo= +ops=3D1)
          &nb= +sp;          +->  Sort  (cost=3D45871.18..46318.16 rows=3D178792width=3D62) (actual time=3D4962.084..5475.636 rows=3D177769 loops=3D1)            &n= +bsp;            = +;  +Sort Key: ac.project_id
        = +            &nb= +sp;      +->  Hash Join  (cost=3D821.20..13193.43
rows=3D17= +8792 width=3D62) (actual time=3D174.905..4295.685 rows=3D177769 loops=3D1)<= +br>            = +            &nb= +sp;        +Hash Cond: ("outer".chart_id =3D "inner".id)
 &= +nbsp;           &nbs= +p;            &= +nbsp;      +->  Hash Join  (cost=3D817.66..10508.02
rows=3D17= +8791
width=3D20) (actual time=3D173.952..2840.824 rows=3D177769 loops=3D= +1)
           &nb= +sp;            = +            &nb= +sp;  +Hash Cond: ("outer".trans_id =3D
"inner".id)
&nbs= +p;            &= +nbsp;           &nbs= +p;             +->  Seq Scan on acc_trans ac
(cost=3D0.00..3304.38 rows=3D1= +81538 width=3D12) (actual time=3D0.062..537.753
rows=3D181322 loops=3D1)= +
            = +;            &n= +bsp;            = +;  +->  Hash  (cost=3D659.55..659.55
rows=3D22844 wid= +th=3D8) (actual time=3D173.625..173.625 rows=3D0 loops=3D1)
  = +            &nb= +sp;            = +            &nb= +sp;     +->  Seq Scan on ar a
(cost=3D0.00..659.55 rows=3D22844 widt= +h=3D8) (actual time=3D0.022..101.828
rows=3D22844 loops=3D1)
 &n= +bsp;            = +;            &n= +bsp;            = +;            +Filter: (customer_id
=3D 11373)
      &= +nbsp;           &nbs= +p;            &= +nbsp; +->  Hash  (cost=3D3.23..3.23 rows=3D123
width=3D5= +0) (actual time=3D0.915..0.915 rows=3D0 loops=3D1)
   &nb= +sp;            = +            &nb= +sp;          +->  Seq Scan on chart c
(cost=3D0.00..3.23 rows=3D123 width= +=3D50) (actual time=3D0.013..0.528 rows=3D123
loops=3D1)
  = + ->  Hash  (cost=3D716.67..716.67 rows=3D1 width=3D4= +) (actual
time=3D129.037..129.037 rows=3D0 loops=3D1)
+         +->  Subquery Scan +"IN_subquery"  (cost=3D716.66..716.67 rows=3D1
width= +=3D4) (actual time=3D129.017..129.025 rows=3D1 loops=3D1)
  &n= +bsp;            +->  Aggregate  (cost=3D716.66..716.66 rows=3D1 +width=3D4)
(actual time=3D129.008..129.011 rows=3D1 loops=3D1)
 = +            &nb= +sp;       +->  Seq Scan on ar  (cost=3D0.00..659.55 rows=3D2284= +4
width=3D4) (actual time=3D0.020..73.266 rows=3D22844 loops=3D1)
&nb= +sp;            = +            &nb= +sp; +Filter: (customer_id =3D 11373)
Total runtime: 9954.133 ms
(28 rows)= +

The shorter query's plan is:


QUERY PLAN

---------= +---------------------------------------------------------------------------= +--------------------------------------------------------------------- +
Hash Join  (cost=3D728.42..732.96 rows=3D8 width=3D50) (actu= +al
time=3D130.908..131.593 rows=3D10 loops=3D1)
   Hash Con= +d: ("outer".id =3D "inner".chart_id)
   -&= +gt;  Seq Scan on chart c  (cost=3D0.00..3.23 + rows=3D123 width=3D50) (actual
time=3D0.006..0.361 rows=3D123 loops=3D1= +)
   ->  Hash  (cost=3D728.40..728.40 r= +ows=3D8 width=3D8) (actual
time=3D130.841..130.841 rows=3D0 loops=3D1)         +->  Nested Loop  (cost=3D716.67..728.40 rows=3D8 +width=3D8) (actual
time=3D130.692..130.805 rows=3D10 loops=3D1)
 = +;            &n= +bsp; +->  Nested Loop  (cost=3D716.67..720.89 rows=3D1 +width=3D8)
(actual time=3D130.626..130.639 rows=3D1 loops=3D1)
 = +            &nb= +sp;       +->  HashAggregate  (cost=3D716.67..716.67 rows=3D1width=3D4) (actual time=3D130.484..130.487 rows=3D1 loops=3D1)
 &= +nbsp;           &nbs= +p;             +->  Subquery Scan "IN_subquery"
(cost=3D716.66..7= +16.67 rows=3D1 width=3D4) (actual time=3D130.455..130.464
rows=3D1 loops= +=3D1)
           = +            &nb= +sp;         +->  Aggregate  (cost=3D716.66..716.66
rows=3D1 wi= +dth=3D4) (actual time=3D130.445..130.448 rows=3D1 loops=3D1)
  = +;            &n= +bsp;            = +;            +->  Seq Scan on ar
(cost=3D0.00..659.55 rows=3D22844 width= +=3D4) (actual time=3D0.020..74.174
rows=3D22844 loops=3D1)
 &nbs= +p;            &= +nbsp;           &nbs= +p;            &= +nbsp;     +Filter: (customer_id =3D 11373)
      &nbs= +p;            &= +nbsp; +->  Index Scan using ar_id_key on ar a
(cost=3D0.00..4.20 r= +ows=3D1 width=3D4) (actual time=3D0.122..0.125 rows=3D1 loops=3D1)
 = +;            &n= +bsp;            = +; +Index Cond: (a.id =3D "outer".max)            &n= +bsp;            = +;  +Filter: (customer_id =3D 11373)
      &nbs= +p;        +->  Index Scan using acc_trans_trans_id_key on acc_trans
ac= +  (cost=3D0.00..7.41 rows=3D8 width=3D12) (actual time=3D0.051..0= +.097 rows=3D10
loops=3D1)
       &= +nbsp;           &nbs= +p; +Index Cond: ("outer".max =3D ac.trans_id)
Total runtime: 131.= +879 ms
(17 rows)

I am not sure if I want to remove support for th= +e other two tables
yet.   However, I wanted to submit this her= +e as a (possibly corner-) +
case where the plan seems to be far slower than it needs to be.

= +Best Wishes,
Chris Travers
Metatron Technology Consulting

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



--
with regards,
S.Gnanavel
Satyam Computer Services= + Ltd. + +------=_Part_2293_14846395.1122544557125-- + +From pgsql-hackers-owner@postgresql.org Thu Jul 28 08:49:57 2005 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7524B529F9 + for ; + Thu, 28 Jul 2005 08:49:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27592-07 + for ; + Thu, 28 Jul 2005 11:49:45 +0000 (GMT) +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by svr1.postgresql.org (Postfix) with ESMTP id DA193529EA + for ; + Thu, 28 Jul 2005 08:49:44 -0300 (ADT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1Dy6tF-0007uU-00; Thu, 28 Jul 2005 07:49:29 -0400 +To: josh@agliodbs.com +Cc: pgsql-hackers@postgresql.org +Subject: Re: wal_buffer tests in +References: <200507271330.02083.josh@agliodbs.com> +In-Reply-To: <200507271330.02083.josh@agliodbs.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 28 Jul 2005 07:49:29 -0400 +Message-ID: <87oe8n881i.fsf@stark.xeocode.com> +Lines: 16 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/1045 +X-Sequence-Number: 71097 + +Josh Berkus writes: + +> Folks, +> +> I ran a wal_buffer test series. It appears that increasing the +> wal_buffers is indeed very important for OLTP applications, potentially +> resulting in as much as a 15% average increase in transaction processing. +> What's interesting is that this is not just true for 8.1, it's true for +> 8.0.3 as well. + +You have wal_buffer set to 2048? That's pretty radical compared to the default +of just 5. Your tests shows you had to go to this large a value to see the +maximum effect? + +-- +greg + + +From pgsql-performance-owner@postgresql.org Thu Jul 28 08:52:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A726752A24 + for ; + Thu, 28 Jul 2005 08:52:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25784-09 + for ; + Thu, 28 Jul 2005 11:52:01 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) + by svr1.postgresql.org (Postfix) with ESMTP id 2CFEA52A21 + for ; + Thu, 28 Jul 2005 08:52:00 -0300 (ADT) +Received: by wproxy.gmail.com with SMTP id 70so405905wra + for ; + Thu, 28 Jul 2005 04:52:04 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=tKrcFYMs/fZ5rJKx9Who9FkYMnDk4ApO/1Yy4EL/CUykFHKPSiiCtnt9fjvbzTPck9Dzhu2JW8LIAYisLneHl9jHxLB2ww/Uwnu/Sk7ipJKiIrkJVOs62/mIO7vKJKgC3YxrQ/65auPTSVU+O4M3CHIL0bcT52gR2YTFgoukmSg= +Received: by 10.54.120.4 with SMTP id s4mr767597wrc; + Thu, 28 Jul 2005 04:52:04 -0700 (PDT) +Received: by 10.54.144.11 with HTTP; Thu, 28 Jul 2005 04:52:03 -0700 (PDT) +Message-ID: +Date: Thu, 28 Jul 2005 13:52:03 +0200 +From: Claus Guttesen +Reply-To: Claus Guttesen +To: Kari Lavikka +Subject: Re: Finding bottleneck +Cc: pgsql-performance@postgresql.org +In-Reply-To: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/435 +X-Sequence-Number: 13676 + +> effective_cache_size =3D 1000000 # typically 8KB each + +I have this setting on postgresql 7.4.8 on FreeBSD with 4 GB RAM: + +effective_cache_size =3D 27462 + +So eventhough your machine runs Debian and you have four times as much +RAM as mine your effective_cache_size is 36 times larger. You could +try lowering this setting. + +regards +Claus + +From pgsql-performance-owner@postgresql.org Thu Jul 28 09:20:41 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CA65D529A4 + for ; + Thu, 28 Jul 2005 09:20:40 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37175-06 + for ; + Thu, 28 Jul 2005 12:20:32 +0000 (GMT) +Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) + by svr1.postgresql.org (Postfix) with ESMTP id 4FE325298B + for ; + Thu, 28 Jul 2005 09:20:31 -0300 (ADT) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Subject: Re: Performance problems testing with Spamassassin 3.1.0 Bayes + module. +Date: Thu, 28 Jul 2005 08:20:35 -0400 +Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DCF21@Herge.rcsinc.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Performance problems testing with Spamassassin 3.1.0 + Bayes module. +Thread-Index: AcWS/JSuYQG7b/vqQHCbJnr1jWca5gAcaJCQ +From: "Merlin Moncure" +To: "Matthew Schumacher" +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/436 +X-Sequence-Number: 13677 + +> I'm not sure how much this has been discussed on the list, but wasn't +> able to find anything relevant in the archives. +>=20 +> The new Spamassassin is due out pretty soon. They are currently +testing +> 3.1.0pre4. One of the things I hope to get out of this release is +bayes +> word stats moved to a real RDBMS. They have separated the mysql +> BayesStore module from the PgSQL one so now postgres can use it's own +> queries. +>=20 +> I loaded all of this stuff up on a test server and am finding that the +> bayes put performance is really not good enough for any real amount of +> mail load. +>=20 +> The performance problems seems to be when the bayes module is +> inserting/updating. This is now handled by the token_put procedure. + +1. you need high performance client side timing (sub 1 millisecond). on +win32 use QueryPerformanceCounter + +2. one by one, convert queries inside your routine into dynamic +versions. That is, use execute 'query string' + +3. Identify the problem. Something somewhere is not using the index. +Because of the way the planner works you have to do this sometimes. + +Merlin + +From pgsql-performance-owner@postgresql.org Thu Jul 28 10:02:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 28CDE52932 + for ; + Thu, 28 Jul 2005 10:02:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44180-05 + for ; + Thu, 28 Jul 2005 13:02:18 +0000 (GMT) +Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) + by svr1.postgresql.org (Postfix) with ESMTP id 339D65291A + for ; + Thu, 28 Jul 2005 10:02:15 -0300 (ADT) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Subject: Re: Finding bottleneck +Date: Thu, 28 Jul 2005 09:02:18 -0400 +Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DCF28@Herge.rcsinc.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Finding bottleneck +Thread-Index: AcWTV1FLZLMsPgagRTmZQRBQ3VnXWAAHFC9A +From: "Merlin Moncure" +To: "Kari Lavikka" +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/437 +X-Sequence-Number: 13678 + +Kari Lavikka wrote: +> shared_buffers =3D 15000 =20 +you can play around with this one but in my experience it doesn't make +much difference anymore (it used to). + +> work_mem =3D 1536 # min 64, size in KB +this seems low. are you sure you are not getting sorts swapped to disk? + +> fsync =3D true # turns forced synchronization on or +off +does turning this to off make a difference? This would help narrow down +where the problem is. + +> commit_delay =3D 80000 # range 0-100000, in microseconds +hm! how did you arrive at this number? try setting to zero and +comparing. + +> stats_start_collector =3D true +> stats_command_string =3D true +with a high query load you may want to consider turning this off. On +win32, I've had some problem with stat's collector under high load +conditions. Not un unix, but it's something to look at. Just turn off +stats for a while and see if it helps. + +good luck! your hardware should be more than adequate. + +Merlin + +From pgsql-performance-owner@postgresql.org Thu Jul 28 11:38:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 31281529C3 + for ; + Thu, 28 Jul 2005 11:38:30 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68310-08 + for ; + Thu, 28 Jul 2005 14:38:28 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 1B4F6529A2 + for ; + Thu, 28 Jul 2005 11:38:25 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 8so325879nzo + for ; + Thu, 28 Jul 2005 07:38:28 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=Mw+vxWEIT6/opwXb2A2+XZJ7+eKPGM+cT3pnmdh2HxIn+ib1e6XA6HN7v3+x7HD4OBkRtU4GCPXapo6g8pHdTIcpeMXiFxsrbXdWhDkCvMcysvQzI4pJp9skHk8iZOmWL+q6+89PGEQshooTsEYyW8aKPHlz4IioTOIBr0Z+Y08= +Received: by 10.36.71.12 with SMTP id t12mr1976998nza; + Thu, 28 Jul 2005 07:38:07 -0700 (PDT) +Received: by 10.36.25.13 with HTTP; Thu, 28 Jul 2005 07:38:06 -0700 (PDT) +Message-ID: <1d219a6f0507280738791f0ea3@mail.gmail.com> +Date: Thu, 28 Jul 2005 10:38:06 -0400 +From: Chris Hoover +Reply-To: Chris Hoover +To: pgsql-performance@postgresql.org +Subject: Fwd: Help with view performance problem +In-Reply-To: <1d219a6f050727092927746db1@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +References: <1d219a6f05072708122cf6abeb@mail.gmail.com> + <1d219a6f050727092927746db1@mail.gmail.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/438 +X-Sequence-Number: 13679 + +Does anyone have any suggestions on this? I did not get any response +from the admin list. + +Thanks, + +Chris + +---------- Forwarded message ---------- +From: Chris Hoover +Date: Jul 27, 2005 12:29 PM +Subject: Re: Help with view performance problem +To: pgsql-admin@postgresql.org + + +I did some more testing, and ran the explain analyze on the problem. +In my session I did a set enable_hashjoin =3D false and then ran the +analyze. This caused it to use the indexes as I have been expecting +it to do. + +Now, how can I get it to use the indexes w/o manipulating the +environment? What make postgresql want to sequentially scan and use a +hash join? + +thanks, + +Chris + +explain analyze with set_hashjoin=3Dfalse; +prob_db=3D#explain analyze select * from clm_com; + + + + QUERY PLAN + + + +---------------------------------------------------------------------------= +------------------------------------------------------------------- +---------------------------------------------------------------------------= +------------------------------------------------------------------- +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +------------------------------------------ + Subquery Scan clm_com (cost=3D1057975.45..1169021.26 rows=3D126910 +width=3D366) (actual time=3D142307.99..225997.22 rows=3D1268649 loops=3D1) + -> Unique (cost=3D1057975.45..1169021.26 rows=3D126910 width=3D366) +(actual time=3D142307.96..206082.30 rows=3D1268649 loops=3D1) + -> Sort (cost=3D1057975.45..1061148.19 rows=3D1269095 +width=3D366) (actual time=3D142307.95..156019.01 rows=3D1268649 loops=3D1) + Sort Key: clmcom1.inv_nbr, clmcom1.inv_qfr, +clmcom1.pat_addr_1, clmcom1.pat_addr_2, clmcom1.pat_city, +clmcom1.pat_cntry, clmcom1.pat_dob, clmcom1.pat_gender_cd, +clmcom1.pat_info_pregnancy_ind, clmcom1.pat_state, clmcom1.pat_suffix, +clmcom1.pat_zip, clmcom1.payto_addr_1, +clmcom1.payto_addr_2, clmcom1.payto_city, clmcom1.payto_cntry, +clmcom1.payto_f_name, clmcom1.payto_m_name, clmcom1.payto_state, +clmcom1.payto_zip, clmcom1.clm_tot_clm_chgs, clmcom1.bill_l_name_org, +clmcom1.clm_delay_rsn_cd, clmcom1.clm_submit_rsn_cd, +clmcom1.payto_l_name_org, clmcom1.payto_prim_id, clmcom1.bill_prim_id, +clmcom1.clm_tot_ncov_chgs, clmcom2.contract_amt, +clmcom2.svc_fac_or_lab_name, clmcom2.svc_fac_addr_1, +clmcom2.svc_fac_addr_2, clmcom2.svc_fac_city, clmcom2.svc_fac_zip + -> Merge Join (cost=3D0.00..565541.46 rows=3D1269095 +width=3D366) (actual time=3D464.89..130638.06 rows=3D1268649 loops=3D1) + Merge Cond: ("outer".inv_nbr =3D "inner".inv_nbr) + Join Filter: ("outer".inv_qfr =3D "inner".inv_qfr) + -> Index Scan using clmcom1_inv_nbr_iview_idx on +clmcom1 (cost=3D0.00..380534.32 rows=3D1269095 width=3D270) (actual +time=3D0.27..82159.37 rows=3D1268649 loops=3D1) + -> Index Scan using clmcom2_inv_nbr_iview_idx on +clmcom2 (cost=3D0.00..159636.25 rows=3D1271198 width=3D96) (actual +time=3D464.56..21774.02 rows=3D1494019 loops=3D1) + Total runtime: 227369.39 msec +(10 rows) + + + +On 7/27/05, Chris Hoover wrote: +> I am having a problem with a view on one of my db's. This view is +> trying to sequentially can the 2 tables it is accessing. However, +> when I explain the view on most of my other db's (all have the same +> schema's), it is using the indexes. Can anyone please help me +> understand why postgres is choosing to sequenially scan both tables? +> +> Both tables in the view have a primary key defined on inv_nbr, +> inv_qfr. Vacuum and analyze have been run on the tables in question +> to try and make sure stats are up to date. +> +> Thanks, +> +> Chris +> PG - 7.3.4 +> RH 2.1 +> +> +> Here is the view definition: +> SELECT DISTINCT clmcom1.inv_nbr AS inventory_number, +> clmcom1.inv_qfr AS inventory_qualifier, +> clmcom1.pat_addr_1 AS patient_address_1, +> clmcom1.pat_addr_2 AS patient_address_2, +> clmcom1.pat_city AS patient_city, +> clmcom1.pat_cntry AS patient_country, +> clmcom1.pat_dob AS patient_date_of_birth, +> clmcom1.pat_gender_cd AS patient_gender_cod= +e, +> clmcom1.pat_info_pregnancy_ind AS pregnancy= +_ind, +> clmcom1.pat_state AS patient_state, +> clmcom1.pat_suffix AS patient_suffix, +> clmcom1.pat_zip AS patient_zip_code, +> clmcom1.payto_addr_1 AS payto_address_1, +> clmcom1.payto_addr_2 AS payto_address_2, +> clmcom1.payto_city, +> clmcom1.payto_cntry AS payto_country, +> clmcom1.payto_f_name AS payto_first_name, +> clmcom1.payto_m_name AS payto_middle_name, +> clmcom1.payto_state, +> clmcom1.payto_zip AS payto_zip_code, +> clmcom1.clm_tot_clm_chgs AS total_claim_cha= +rge, +> clmcom1.bill_l_name_org AS +> billing_last_name_or_org, +> clmcom1.clm_delay_rsn_cd AS +> claim_delay_reason_code, +> clmcom1.clm_submit_rsn_cd AS +> claim_submit_reason_code, +> clmcom1.payto_l_name_org AS +> payto_last_name_or_org, +> clmcom1.payto_prim_id AS payto_primary_id, +> clmcom1.bill_prim_id AS billing_prov_primar= +y_id, +> clmcom1.clm_tot_ncov_chgs AS total_ncov_cha= +rge, +> clmcom2.contract_amt AS contract_amount, +> clmcom2.svc_fac_or_lab_name, +> clmcom2.svc_fac_addr_1 AS svc_fac_address_1= +, +> clmcom2.svc_fac_addr_2 AS svc_fac_address_2= +, +> clmcom2.svc_fac_city, +> clmcom2.svc_fac_zip AS svc_fac_zip_code +> FROM (clmcom1 LEFT JOIN clmcom2 ON (((clmcom1.inv_nbr =3D +> clmcom2.inv_nbr) AND +> +> (clmcom1.inv_qfr =3D clmcom2.inv_qfr)))) +> ORDER BY clmcom1.inv_nbr, +> clmcom1.inv_qfr, +> clmcom1.pat_addr_1, +> clmcom1.pat_addr_2, +> clmcom1.pat_city, +> clmcom1.pat_cntry, +> clmcom1.pat_dob, +> clmcom1.pat_gender_cd, +> clmcom1.pat_info_pregnancy_ind, +> clmcom1.pat_state, +> clmcom1.pat_suffix, +> clmcom1.pat_zip, +> clmcom1.payto_addr_1, +> clmcom1.payto_addr_2, +> clmcom1.payto_city, +> clmcom1.payto_cntry, +> clmcom1.payto_f_name, +> clmcom1.payto_m_name, +> clmcom1.payto_state, +> clmcom1.payto_zip, +> clmcom1.clm_tot_clm_chgs, +> clmcom1.bill_l_name_org, +> clmcom1.clm_delay_rsn_cd, +> clmcom1.clm_submit_rsn_cd, +> clmcom1.payto_l_name_org, +> clmcom1.payto_prim_id, +> clmcom1.bill_prim_id, +> clmcom1.clm_tot_ncov_chgs, +> clmcom2.contract_amt, +> clmcom2.svc_fac_or_lab_name, +> clmcom2.svc_fac_addr_1, +> clmcom2.svc_fac_addr_2, +> clmcom2.svc_fac_city, +> clmcom2.svc_fac_zip; +> +> +> Here is the explain analyze from the problem db: +> prob_db=3D# explain analyze select * from clm_com; +> +> +> +> QUERY PLAN +> +> +> +> -------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------- +> Subquery Scan clm_com (cost=3D1039824.35..1150697.61 rows=3D126712 +> width=3D367) (actual time=3D311792.78..405819.03 rows=3D1266114 loops=3D1= +) +> -> Unique (cost=3D1039824.35..1150697.61 rows=3D126712 width=3D367) +> (actual time=3D311792.74..386313.14 rows=3D1266114 loops=3D1) +> -> Sort (cost=3D1039824.35..1042992.16 rows=3D1267123 +> width=3D367) (actual time=3D311792.74..338189.48 rows=3D1266114 loops=3D1= +) +> Sort Key: clmcom1.inv_nbr, clmcom1.inv_qfr, +> clmcom1.pat_addr_1, clmcom1.pat_addr_2, clmcom1.pat_city, +> clmcom1.pat_cntry, clmcom1.pat_dob, clmcom1.pat_gender_cd, +> clmcom1.pat_info_pregnancy_ind, clmcom1.pat_state, clmcom1.pat_suffix, +> clmcom1.pat_zip, clmcom1.payto_addr_1, +> clmcom1.payto_addr_2, clmcom1.payto_city, clmcom1.payto_cntry, +> clmcom1.payto_f_name, clmcom1.payto_m_name, clmcom1.payto_state, +> clmcom1.payto_zip, clmcom1.clm_tot_clm_chgs, clmcom1.bill_l_name_org, +> clmcom1.clm_delay_rsn_cd, clmcom1.clm_submit_rsn_cd, +> clmcom1.payto_l_name_org, clmcom1.payto_prim_id, clmcom1.bill_prim_id, +> clmcom1.clm_tot_ncov_chgs, clmcom2.contract_amt, +> clmcom2.svc_fac_or_lab_name, clmcom2.svc_fac_addr_1, +> clmcom2.svc_fac_addr_2, clmcom2.svc_fac_city, clmcom2.svc_fac_zip +> -> Hash Join (cost=3D132972.78..548171.70 rows=3D1267123 +> width=3D367) (actual time=3D16999.32..179359.43 rows=3D1266114 loops=3D1) +> Hash Cond: ("outer".inv_nbr =3D "inner".inv_nbr) +> Join Filter: ("outer".inv_qfr =3D "inner".inv_qfr) +> -> Seq Scan on clmcom1 (cost=3D0.00..267017.23 +> rows=3D1267123 width=3D271) (actual time=3D0.11..84711.83 rows=3D1266114 +> loops=3D1) +> -> Hash (cost=3D111200.82..111200.82 rows=3D126958= +2 +> width=3D96) (actual time=3D16987.45..16987.45 rows=3D0 loops=3D1) +> -> Seq Scan on clmcom2 +> (cost=3D0.00..111200.82 rows=3D1269582 width=3D96) (actual +> time=3D0.07..12164.81 rows=3D1266108 loops=3D1) +> Total runtime: 407317.47 msec +> (11 rows) +> ~ +> +> +> +> Here is the explain analyze from a good db (on the same postgres cluster)= +; +> good_db=3D# explain analyze select * from clm_com; +> +> +> +> +> +> QUERY PLAN +> -------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------------------------------------------------------= +---------------------------- +> Subquery Scan clm_com (cost=3D78780.59..89498.29 rows=3D12249 width=3D3= +59) +> (actual time=3D73045.36..79974.37 rows=3D122494 loops=3D1) +> -> Unique (cost=3D78780.59..89498.29 rows=3D12249 width=3D359) (actu= +al +> time=3D73045.28..78031.99 rows=3D122494 loops=3D1) +> -> Sort (cost=3D78780.59..79086.81 rows=3D122488 width=3D359) +> (actual time=3D73045.28..73362.94 rows=3D122494 loops=3D1) +> Sort Key: clmcom1.inv_nbr, clmcom1.inv_qfr, +> clmcom1.pat_addr_1, clmcom1.pat_addr_2, clmcom1.pat_city, +> clmcom1.pat_cntry, clmcom1.pat_dob, clmcom1.pat_gender_cd, +> clmcom1.pat_info_pregnancy_ind, clmcom1.pat_state, clmcom1.pat_suffix, +> clmcom1.pat_zip, clmcom1.payto_addr_1, clmcom1.payto_addr_2, +> clmcom1.payto_city, clmcom1.payto_cntry, clmcom1.payto_f_name, +> clmcom1.payto_m_name, clmcom1.payto_state, clmcom1.payto_zip, +> clmcom1.clm_tot_clm_chgs, clmcom1.bill_l_name_org, +> clmcom1.clm_delay_rsn_cd, clmcom1.clm_submit_rsn_cd, +> clmcom1.payto_l_name_org, clmcom1.payto_prim_id, clmcom1.bill_prim_id, +> clmcom1.clm_tot_ncov_chgs, clmcom2.contract_amt, +> clmcom2.svc_fac_or_lab_name, clmcom2.svc_fac_addr_1, +> clmcom2.svc_fac_addr_2, clmcom2.svc_fac_city, clmcom2.svc_fac_zip +> -> Merge Join (cost=3D0.00..56945.12 rows=3D122488 +> width=3D359) (actual time=3D54.76..71635.65 rows=3D122494 loops=3D1) +> Merge Cond: (("outer".inv_nbr =3D "inner".inv_nbr) +> AND ("outer".inv_qfr =3D "inner".inv_qfr)) +> -> Index Scan using clmcom1_pkey on clmcom1 +> (cost=3D0.00..38645.61 rows=3D122488 width=3D267) (actual +> time=3D25.60..49142.16 rows=3D122494 loops=3D1) +> -> Index Scan using clmcom2_pkey on clmcom2 +> (cost=3D0.00..16004.08 rows=3D122488 width=3D92) (actual +> time=3D29.09..19418.94 rows=3D122494 loops=3D1) +> Total runtime: 80162.26 msec +> (9 rows) +> + +From pgsql-performance-owner@postgresql.org Thu Jul 28 13:13:51 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 378BE529A0 + for ; + Thu, 28 Jul 2005 13:13:35 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91158-10 + for ; + Thu, 28 Jul 2005 16:13:26 +0000 (GMT) +Received: from crestone.coronasolutions.com (crestone.coronasolutions.com + [66.45.104.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 0E17752889 + for ; + Thu, 28 Jul 2005 13:13:24 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by crestone.coronasolutions.com (Postfix) with ESMTP id E2B0864419C + for ; + Thu, 28 Jul 2005 10:12:56 -0600 (MDT) +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 20114-07 for ; + Thu, 28 Jul 2005 10:12:55 -0600 (MDT) +Received: from [192.168.1.12] (c-24-9-24-35.hsd1.co.comcast.net [24.9.24.35]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by crestone.coronasolutions.com (Postfix) with ESMTP id DF3D4644178 + for ; + Thu, 28 Jul 2005 10:12:54 -0600 (MDT) +Mime-Version: 1.0 (Apple Message framework v730) +In-Reply-To: <1d219a6f0507280738791f0ea3@mail.gmail.com> +References: <1d219a6f05072708122cf6abeb@mail.gmail.com> + <1d219a6f050727092927746db1@mail.gmail.com> + <1d219a6f0507280738791f0ea3@mail.gmail.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +From: Dan Harris +Subject: Re: Fwd: Help with view performance problem +Date: Thu, 28 Jul 2005 10:14:32 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.730) +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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/439 +X-Sequence-Number: 13680 + + +On Jul 28, 2005, at 8:38 AM, Chris Hoover wrote: +> +> +> I did some more testing, and ran the explain analyze on the problem. +> In my session I did a set enable_hashjoin = false and then ran the +> analyze. This caused it to use the indexes as I have been expecting +> it to do. +> +> Now, how can I get it to use the indexes w/o manipulating the +> environment? What make postgresql want to sequentially scan and use a +> hash join? +> +> thanks, +> +> Chris +> +> explain analyze with set_hashjoin=false; +> prob_db=#explain analyze select * from clm_com; +> +> + +I had something similar to this happen recently. The planner was +choosing a merge join and seq scan because my 'random_page_cost' was +set too high. I had it at 3 , and ended up settling at 1.8 to get it +to correctly use my indices. Once that change was in place, the +planner did the 'right' thing for me. + +Not sure if this will help you, but it sounds similar. + +-Dan + +From pgsql-performance-owner@postgresql.org Thu Jul 28 14:02:46 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EBD1952B49 + for ; + Thu, 28 Jul 2005 14:02:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04843-04 + for ; + Thu, 28 Jul 2005 17:02:39 +0000 (GMT) +Received: from mail.travelamericas.com (unknown [206.130.134.147]) + by svr1.postgresql.org (Postfix) with SMTP id 9BDDC52B5D + for ; + Thu, 28 Jul 2005 14:02:37 -0300 (ADT) +Received: (qmail 6500 invoked from network); 28 Jul 2005 16:55:55 -0000 +Received: from unknown (HELO ?10.0.0.253?) (10.0.0.253) + by verkiel.travelamericas.com with SMTP; 28 Jul 2005 16:55:55 -0000 +Message-ID: <42E90E19.3030702@travelamericas.com> +Date: Thu, 28 Jul 2005 09:55:53 -0700 +From: Chris Travers +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Gnanavel S +Cc: pgsql-performance@postgresql.org +Subject: Re: Left joining against two empty tables makes a query +References: <42E86A03.1070803@travelamericas.com> + +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/441 +X-Sequence-Number: 13682 + +Gnanavel S wrote: + +> +> +> vacuum & reindex the department and project table as the planner +> expects there are 1060 rows but actually returning nothing. + +I guess I should have mentioned that I have been vacuuming and +reindexing at least once a week, and I did so just before running this test. +Normally I do: +vacuum analyze; +reindex database ....; + +Secondly, the project table has *never* had anything in it. So where +are these numbers coming from? + +Best Wishes, +Chris Travers +Metatron Technology Consulting + +From pgsql-performance-owner@postgresql.org Thu Jul 28 14:00:40 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 886BE529CC + for ; + Thu, 28 Jul 2005 14:00:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04559-03 + for ; + Thu, 28 Jul 2005 17:00:29 +0000 (GMT) +Received: from e5.ny.us.ibm.com (e5.ny.us.ibm.com [32.97.182.145]) + by svr1.postgresql.org (Postfix) with ESMTP id E754C52AF0 + for ; + Thu, 28 Jul 2005 14:00:21 -0300 (ADT) +Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) + by e5.ny.us.ibm.com (8.12.11/8.12.11) with ESMTP id j6SH0KlA025210 + for ; Thu, 28 Jul 2005 13:00:20 -0400 +Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) + by d01relay02.pok.ibm.com (8.12.10/NCO/VERS6.7) with ESMTP id + j6SH0KEk262098 + for ; Thu, 28 Jul 2005 13:00:20 -0400 +Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) + by d01av02.pok.ibm.com (8.12.11/8.13.3) with ESMTP id j6SH0JcL016934 + for ; Thu, 28 Jul 2005 13:00:20 -0400 +Received: from d01ml255.pok.ibm.com (d01ml255.pok.ibm.com [9.56.227.128]) + by d01av02.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j6SH0IZf016498 + for ; Thu, 28 Jul 2005 13:00:19 -0400 +Subject: Unable to explain DB error +To: pgsql-performance@postgresql.org +X-Mailer: Lotus Notes Release 6.0.2CF1 June 9, 2003 +Message-ID: + +From: Steven Rosenstein +Date: Thu, 28 Jul 2005 13:00:05 -0400 +X-MIMETrack: Serialize by Router on D01ML255/01/M/IBM(Release 6.53HF103 | + November 15, 2004) at 07/28/2005 13:00:18 +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.305 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200507/440 +X-Sequence-Number: 13681 + + + + + +Postgres V7.3.9-2. + +While executing a query in psql, the following error was generated: + +vsa=# select * from vsa.dtbl_logged_event_20050318 where id=2689472; +PANIC: open of /vsa/db/pg_clog/0FC0 failed: No such file or directory +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. +!# + +I checked in the /vsa/db/pg_clog directory, and the files have monotonically increasing filenames starting with 0000. The most recent names are: + +-rw------- 1 postgres postgres 262144 Jul 25 21:39 04CA +-rw------- 1 postgres postgres 262144 Jul 26 01:10 04CB +-rw------- 1 postgres postgres 262144 Jul 26 05:39 04CC +-rw------- 1 postgres postgres 262144 Jul 28 00:01 04CD +-rw------- 1 postgres postgres 237568 Jul 28 11:31 04CE + +Any idea why Postgres would be looking for a clog file name 0FC0 when the most recent filename is 04CE? + +Any help and suggestions for recovery are appreciated. + +--- Steve +___________________________________________________________________________________ + +Steven Rosenstein +IT Architect/Developer | IBM Virtual Server Administration +Voice/FAX: 845-689-2064 | Cell: 646-345-6978 | Tieline: 930-6001 +Text Messaging: 6463456978 @ mobile.mycingular.com +Email: srosenst @ us.ibm.com + +"Learn from the mistakes of others because you can't live long enough to +make them all yourself." -- Eleanor Roosevelt + + +From pgsql-performance-owner@postgresql.org Thu Jul 28 14:35:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 97F68529FD + for ; + Thu, 28 Jul 2005 14:35:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10065-08 + for ; + Thu, 28 Jul 2005 17:35:22 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.200]) + by svr1.postgresql.org (Postfix) with ESMTP id ECA5D52B84 + for ; + Thu, 28 Jul 2005 14:35:16 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id 8so356729nzo + for ; + Thu, 28 Jul 2005 10:35:17 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=F6GEESUg4xHYNlUCSmV9SK0dGMvszWV0gDoWOlCsFrsMAa5Zjsjr2nz8fzu0Yd/YX2bkjoZ55iKepmOVlRKjLTAL6NX4tppMEUmpeMZdI1FPOIOVVxh00iDHc1VAJarUaTCe1z5+19mTzgeOtcJsrA8QY1fC8TFNJdpLCenIVHA= +Received: by 10.36.133.15 with SMTP id g15mr2073505nzd; + Thu, 28 Jul 2005 10:34:55 -0700 (PDT) +Received: by 10.36.25.13 with HTTP; Thu, 28 Jul 2005 10:34:54 -0700 (PDT) +Message-ID: <1d219a6f05072810341d67c525@mail.gmail.com> +Date: Thu, 28 Jul 2005 13:34:54 -0400 +From: Chris Hoover +Reply-To: Chris Hoover +To: Dan Harris +Subject: Re: Fwd: Help with view performance problem +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: <1d219a6f05072708122cf6abeb@mail.gmail.com> + <1d219a6f050727092927746db1@mail.gmail.com> + <1d219a6f0507280738791f0ea3@mail.gmail.com> + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/442 +X-Sequence-Number: 13683 + +I'm alreading running at 1.5. It looks like if I drop the +random_page_cost t0 1.39, it starts using the indexes. Are there any +unseen issues with dropping the random_page_cost this low? + +Thanks, + +Chris + +On 7/28/05, Dan Harris wrote: +>=20 +> On Jul 28, 2005, at 8:38 AM, Chris Hoover wrote: +> > +> > +> > I did some more testing, and ran the explain analyze on the problem. +> > In my session I did a set enable_hashjoin =3D false and then ran the +> > analyze. This caused it to use the indexes as I have been expecting +> > it to do. +> > +> > Now, how can I get it to use the indexes w/o manipulating the +> > environment? What make postgresql want to sequentially scan and use a +> > hash join? +> > +> > thanks, +> > +> > Chris +> > +> > explain analyze with set_hashjoin=3Dfalse; +> > prob_db=3D#explain analyze select * from clm_com; +> > +> > +>=20 +> I had something similar to this happen recently. The planner was +> choosing a merge join and seq scan because my 'random_page_cost' was +> set too high. I had it at 3 , and ended up settling at 1.8 to get it +> to correctly use my indices. Once that change was in place, the +> planner did the 'right' thing for me. +>=20 +> Not sure if this will help you, but it sounds similar. +>=20 +> -Dan +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster +> + +From pgsql-performance-owner@postgresql.org Thu Jul 28 15:14:03 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DC3D052B84 + for ; + Thu, 28 Jul 2005 15:14:01 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18749-03 + for ; + Thu, 28 Jul 2005 18:13:53 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 251F652AAB + for ; + Thu, 28 Jul 2005 15:13:52 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6SIDpfF025700; + Thu, 28 Jul 2005 14:13:51 -0400 (EDT) +To: Chris Travers +Cc: Gnanavel S , + pgsql-performance@postgresql.org +Subject: Re: Left joining against two empty tables makes a query +In-reply-to: <42E90E19.3030702@travelamericas.com> +References: <42E86A03.1070803@travelamericas.com> + + <42E90E19.3030702@travelamericas.com> +Comments: In-reply-to Chris Travers + message dated "Thu, 28 Jul 2005 09:55:53 -0700" +Date: Thu, 28 Jul 2005 14:13:51 -0400 +Message-ID: <25699.1122574431@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/443 +X-Sequence-Number: 13684 + +Chris Travers writes: +> Secondly, the project table has *never* had anything in it. So where +> are these numbers coming from? + +The planner is designed to assume a certain minimum size (10 pages) when +it sees that a table is of zero physical length. The reason for this is +that there are lots of scenarios where a plan created just after a table +is first created will continue to be used while the table is filled, and +if we optimized on the assumption of zero size we would produce plans +that seriously suck once the table gets big. Assuming a few thousand +rows keeps us out of the worst problems of this type. + +(If we had an infrastructure for regenerating cached plans then we could +fix this more directly, by replanning whenever the table size changes +"too much". We don't yet but I hope there will be something by 8.2.) + +You might try going ahead and actually putting a row or two into +projects; vacuuming that will change the state to where the planner +will believe the small size. (If you aren't ever planning to have +anything in projects, why have the table at all?) + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 28 15:19:38 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DAAB65285A + for ; + Thu, 28 Jul 2005 15:19:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20061-05 + for ; + Thu, 28 Jul 2005 18:19:29 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id AEA0052A01 + for ; + Thu, 28 Jul 2005 15:19:28 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6SIJS06025775; + Thu, 28 Jul 2005 14:19:29 -0400 (EDT) +To: Steven Rosenstein +Cc: pgsql-performance@postgresql.org +Subject: Re: Unable to explain DB error +In-reply-to: + +References: + +Comments: In-reply-to Steven Rosenstein + message dated "Thu, 28 Jul 2005 13:00:05 -0400" +Date: Thu, 28 Jul 2005 14:19:28 -0400 +Message-ID: <25774.1122574768@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/444 +X-Sequence-Number: 13685 + +Steven Rosenstein writes: +> Any idea why Postgres would be looking for a clog file name 0FC0 when the most recent filename is 04CE? + +Corrupt data --- specifically a bad transaction number in a tuple +header. (In practice, this is the first field looked at in which +we can readily detect an error, so you tend to see this symptom for +any serious data corruption situation. The actual fault may well +be something like a corrupt page header causing the code to follow +"tuple pointers" that point to garbage.) + +See the PG list archives for past discussions of dealing with corrupt +data. pgsql-performance is pretty off-topic for this. + +BTW, PG 7.4 and up handle this sort of thing much more gracefully ... +they can't resurrect corrupt data of course, but they tend not to +panic. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 28 15:27:49 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E002B52A35 + for ; + Thu, 28 Jul 2005 15:27:47 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20591-06 + for ; + Thu, 28 Jul 2005 18:27:45 +0000 (GMT) +Received: from mail.Mi8.com (mail.mi8.com [63.240.6.50]) + by svr1.postgresql.org (Postfix) with ESMTP id 104B352A15 + for ; + Thu, 28 Jul 2005 15:27:44 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- GW05 Welcome + to Mi8 Corporation www.Mi8.com); Thu, 28 Jul 2005 14:27:38 -0400 +X-Server-Uuid: E0C866E6-C6CD-48B5-AE61-E57E73CF3CC7 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 28 Jul + 2005 14:27:37 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Thu, 28 Jul + 2005 14:27:37 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Thu, 28 Jul 2005 11:27:36 -0700 +Subject: Re: Finding bottleneck +From: "Luke Lonergan" +To: "Kari Lavikka" , pgsql-performance@postgresql.org +Message-ID: +In-Reply-To: +MIME-Version: 1.0 +X-OriginalArrivalTime: 28 Jul 2005 18:27:37.0969 (UTC) + FILETIME=[0817CE10:01C593A2] +X-WSS-ID: 6EF7FC101M815461377-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, hits=1.577 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/445 +X-Sequence-Number: 13686 + +On 7/28/05 2:21 AM, "Kari Lavikka" wrote: + +There's a new profiling tool called oprofile: + + http://oprofile.sourceforge.net/download/ + +that can be run without instrumenting the binaries beforehand. To actually +find out what the code is doing during these stalls, oprofile can show you +in which routines the CPU is spending time when you start/stop the +profiling. + +As an alternative to the "guess->change parameters->repeat" approach, this +is the most direct way to find the exact nature of the problem. + +- Luke + + + +From pgsql-hackers-owner@postgresql.org Thu Jul 28 18:54:29 2005 +X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6643D5372B + for ; + Thu, 28 Jul 2005 18:54:28 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07598-02 + for ; + Thu, 28 Jul 2005 21:54:27 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 668A7537AD + for ; + Thu, 28 Jul 2005 18:54:19 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7666796; Thu, 28 Jul 2005 14:56:34 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Greg Stark +Subject: Re: wal_buffer tests in +Date: Thu, 28 Jul 2005 14:57:10 -0700 +User-Agent: KMail/1.8 +Cc: pgsql-hackers@postgresql.org +References: <200507271330.02083.josh@agliodbs.com> + <87oe8n881i.fsf@stark.xeocode.com> +In-Reply-To: <87oe8n881i.fsf@stark.xeocode.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200507281457.10637.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/1061 +X-Sequence-Number: 71113 + +Greg, + +> You have wal_buffer set to 2048? That's pretty radical compared to the +> default of just 5. Your tests shows you had to go to this large a value +> to see the maximum effect? + +No, take a look at the graph. It looks like we got the maximum effect +from a wal_buffers somewhere between 64 and 256. On the DBT2 runs, any +variation less than 5% is just noise. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Jul 28 20:06:36 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7084852AA3 + for ; + Thu, 28 Jul 2005 20:06:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42277-04 + for ; + Thu, 28 Jul 2005 23:06:29 +0000 (GMT) +Received: from veggie-fuel.com (veggie-fuel.com [200.46.208.238]) + by svr1.postgresql.org (Postfix) with ESMTP id 1714B52AFA + for ; + Thu, 28 Jul 2005 20:06:11 -0300 (ADT) +Received: from localhost (unknown [200.46.204.144]) + by veggie-fuel.com (Postfix) with ESMTP id 8222D35F9D9 + for ; + Thu, 28 Jul 2005 23:06:13 +0000 (GMT) +Received: from veggie-fuel.com ([200.46.208.238]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37468-10 for ; + Thu, 28 Jul 2005 23:06:04 +0000 (GMT) +Received: from [10.0.0.7] (63-228-143-68.phnx.qwest.net [63.228.143.68]) + by veggie-fuel.com (Postfix) with ESMTP id CD81035F9D6 + for ; + Thu, 28 Jul 2005 23:06:04 +0000 (GMT) +Subject: Two queries are better than one? +From: Karim Nassar +Reply-To: karim.nassar@acm.org +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Date: Thu, 28 Jul 2005 16:04:25 -0700 +Message-Id: <1122591866.11860.11.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.069 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/446 +X-Sequence-Number: 13687 + +I ran into a situation today maintaining someone else's code where the +sum time running 2 queries seems to be faster than 1. The original code +was split into two queries. I thought about joining them, but +considering the intelligence of my predecessor, I wanted to test it. + +The question is, which technique is really faster? Is there some hidden +setup cost I don't see with explain analyze? + +Postgres 7.4.7, Redhat AES 3 + +Each query individually: + +test=> explain analyze +test-> select * from order WHERE ord_batch='343B' AND ord_id='12-645'; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------- + Index Scan using order_pkey on order (cost=0.00..6.02 rows=1 width=486) (actual time=0.063..0.066 rows=1 loops=1) + Index Cond: ((ord_batch = '343B'::bpchar) AND (ord_id = '12-645'::bpchar)) + Total runtime: 0.172 ms +(3 rows) + + +test=> explain analyze +test-> select cli_name from client where cli_code='1837'; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------- + Index Scan using client_pkey on client (cost=0.00..5.98 rows=2 width=39) (actual time=0.043..0.047 rows=1 loops=1) + Index Cond: (cli_code = '1837'::bpchar) + Total runtime: 0.112 ms +(3 rows) + +Joined: + +test=> explain analyze +test-> SELECT cli_name,order.* +test-> FROM order +test-> JOIN client ON (ord_client = cli_code) +test-> WHERE ord_batch='343B' AND ord_id='12-645'; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- + Nested Loop (cost=0.00..12.00 rows=2 width=525) (actual time=0.120..0.128 rows=1 loops=1) + -> Index Scan using order_pkey on order (cost=0.00..6.02 rows=1 width=486) (actual time=0.064..0.066 rows=1 loops=1) + Index Cond: ((ord_batch = '343B'::bpchar) AND (ord_id = '12-645'::bpchar)) + -> Index Scan using client_pkey on client (cost=0.00..5.98 rows=1 width=51) (actual time=0.023..0.026 rows=1 loops=1) + Index Cond: ("outer".ord_client = client.cli_code) + Total runtime: 0.328 ms +(6 rows) + + +-- +Karim Nassar + + +From pgsql-performance-owner@postgresql.org Thu Jul 28 20:43:39 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2F00C529B6 + for ; + Thu, 28 Jul 2005 20:43:38 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47294-08 + for ; + Thu, 28 Jul 2005 23:43:35 +0000 (GMT) +Received: from smtp.osdl.org (smtp.osdl.org [65.172.181.4]) + by svr1.postgresql.org (Postfix) with ESMTP id 4B15252971 + for ; + Thu, 28 Jul 2005 20:43:32 -0300 (ADT) +Received: from lemming.pdx.osdl.net (fw.osdl.org [65.172.181.6]) + (authenticated bits=0) + by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j6SNhEjA013300 + (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); + Thu, 28 Jul 2005 16:43:15 -0700 +Message-Id: <200507282343.j6SNhEjA013300@smtp.osdl.org> +Date: Thu, 28 Jul 2005 16:43:52 -0700 +From: Mark Wong +To: "Luke Lonergan" +Cc: "Joshua D. Drake" , + "Patrick Welche" , + pgsql-performance@postgresql.org, maryedie@osdl.org +Subject: Re: [PATCHES] COPY FROM performance improvements +In-Reply-To: +References: <42E128BD.2000104@commandprompt.com> + +Organization: OSDL +X-Mailer: Sylpheed-Claws 1.0.4a (GTK+ 1.2.10; x86_64-pc-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-MIMEDefang-Filter: osdl$Revision: 1.113 $ +X-Scanned-By: MIMEDefang 2.36 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.055 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/447 +X-Sequence-Number: 13688 + +On Fri, 22 Jul 2005 12:28:43 -0700 +"Luke Lonergan" wrote: + +> Joshua, +> +> On 7/22/05 10:11 AM, "Joshua D. Drake" wrote: +> > The database server is a PE (Power Edge) 6600 +> > +> > Database Server IO: +> > +> > [root@master root]# /sbin/hdparm -tT /dev/sda +> > +> > /dev/sda: +> > Timing buffer-cache reads: 1888 MB in 2.00 seconds = 944.00 MB/sec +> > Timing buffered disk reads: 32 MB in 3.06 seconds = 10.46 MB/sec +> > +> > Second Database Server IO: +> > +> > [root@pq-slave root]# /sbin/hdparm -tT /dev/sda +> > +> > /dev/sda: +> > Timing buffer-cache reads: 1816 MB in 2.00 seconds = 908.00 MB/sec +> > Timing buffered disk reads: 26 MB in 3.11 seconds = 8.36 MB/sec +> > [root@pq-slave root]# +> +> Can you post the "time dd if=/dev/zero of=bigfile bs=8k count=500000" +> results? Also do the reverse (read the file) with "time dd if=bigfile +> of=/dev/null bs=8k". +> +> I think you are observing what we've known for a while, hardware RAID is +> horribly slow. We've not found a hardware RAID adapter of this class yet +> that shows reasonable read or write performance. The Adaptec 2400R or the +> LSI or others have terrible internal I/O compared to raw SCSI with software +> RAID, and even the CPU usage is higher on these cards while doing slower I/O +> than linux SW RAID. +> +> Notably - we've found that the 3Ware RAID controller does a better job than +> the low end SCSI RAID at HW RAID support, and also exports JBOD at high +> speeds. If you export JBOD on the low end SCSI RAID adapters, the +> performance is also very poor, though generally faster than using HW RAID. + +Are there any recommendations for Qlogic controllers on Linux, scsi or +fiber channel? I might be able to my hands on some. I have pci-x slots +for AMD, Itanium, or POWER5 if the architecture makes a difference. + +Mark + +From pgsql-performance-owner@postgresql.org Thu Jul 28 20:57:59 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EF8B652A48 + for ; + Thu, 28 Jul 2005 20:57:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53326-06 + for ; + Thu, 28 Jul 2005 23:57:54 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 6FDA452A38 + for ; + Thu, 28 Jul 2005 20:57:52 -0300 (ADT) +Received: from [192.168.1.101] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.13.4/8.13.4) with ESMTP id + j6SNv7M6023411; Thu, 28 Jul 2005 16:57:08 -0700 +Message-ID: <42E970E4.4010902@commandprompt.com> +Date: Thu, 28 Jul 2005 16:57:24 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Mark Wong +Cc: Luke Lonergan , + Patrick Welche , + pgsql-performance@postgresql.org, maryedie@osdl.org +Subject: Re: [PATCHES] COPY FROM performance improvements +References: <42E128BD.2000104@commandprompt.com> + + <200507282343.j6SNhEjA013300@smtp.osdl.org> +In-Reply-To: <200507282343.j6SNhEjA013300@smtp.osdl.org> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/448 +X-Sequence-Number: 13689 + +>> +>>>[root@pq-slave root]# /sbin/hdparm -tT /dev/sda +>>> +>>>/dev/sda: +>>> Timing buffer-cache reads: 1816 MB in 2.00 seconds = 908.00 MB/sec +>>> Timing buffered disk reads: 26 MB in 3.11 seconds = 8.36 MB/sec +>>>[root@pq-slave root]# +>> +>>Can you post the "time dd if=/dev/zero of=bigfile bs=8k count=500000" +>>results? Also do the reverse (read the file) with "time dd if=bigfile +>>of=/dev/null bs=8k". + +I didn't see this come across before... here ya go: + +time dd if=/dev/zero of=bigfile bs=8k count=500000 + +500000+0 records in +500000+0 records out + +real 1m52.738s +user 0m0.310s +sys 0m36.590s + +time dd if=bigfile of=/dev/null bs=8k + +time dd if=bigfile of=/dev/null bs=8k +500000+0 records in +500000+0 records out + +real 4m38.742s +user 0m0.320s +sys 0m27.870s + + +FYI on your hardware raid comment... I easily get 50 megs a second on my +3ware controllers and faster on my LSI SATA controllers. + +Sincerely, + +Joshua D. Drake + + + + +> +-- +Your PostgreSQL solutions provider, Command Prompt, Inc. +24x7 support - 1.800.492.2240, programming, and consulting +Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit +http://www.commandprompt.com / http://www.postgresql.org + +From pgsql-performance-owner@postgresql.org Thu Jul 28 21:13:33 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3D1955298B + for ; + Thu, 28 Jul 2005 21:13:32 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53994-07 + for ; + Fri, 29 Jul 2005 00:13:27 +0000 (GMT) +Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 487EE529B6 + for ; + Thu, 28 Jul 2005 21:13:22 -0300 (ADT) +Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net + [64.4.232.33]) (authenticated bits=0) + by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j6T0Qgja015145 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) + for ; Thu, 28 Jul 2005 16:26:43 -0800 +Message-ID: <42E9749F.6000709@aptalaska.net> +Date: Thu, 28 Jul 2005 16:13:19 -0800 +From: Matthew Schumacher +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> +In-Reply-To: <1122532023.25574.1.camel@localhost.localdomain> +X-Enigmail-Version: 0.91.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Spam-Bayes: Learn: ham +X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/449 +X-Sequence-Number: 13690 + +Karim Nassar wrote: +> On Wed, 2005-07-27 at 14:35 -0800, Matthew Schumacher wrote: +> +> +>>I put the rest of the schema up at +>>http://www.aptalaska.net/~matt.s/bayes/bayes_pg.sql in case someone +>>needs to see it too. +> +> +> Do you have sample data too? +> + +Ok, I finally got some test data together so that others can test +without installing SA. + +The schema and test dataset is over at +http://www.aptalaska.net/~matt.s/bayes/bayesBenchmark.tar.gz + +I have a pretty fast machine with a tuned postgres and it takes it about +2 minutes 30 seconds to load the test data. Since the test data is the +bayes information on 616 spam messages than comes out to be about 250ms +per message. While that is doable, it does add quite a bit of overhead +to the email system. + +Perhaps this is as fast as I can expect it to go, if that's the case I +may have to look at mysql, but I really don't want to do that. + +I will be working on some other benchmarks, and reading though exactly +how bayes works, but at least there is some data to play with. + +schu + +From pgsql-performance-owner@postgresql.org Thu Jul 28 22:55:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6490A52923 + for ; + Thu, 28 Jul 2005 22:55:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79420-10 + for ; + Fri, 29 Jul 2005 01:55:03 +0000 (GMT) +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 353C45280D + for ; + Thu, 28 Jul 2005 22:55:00 -0300 (ADT) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j6T1rNIj028754 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Thu, 28 Jul 2005 19:53:25 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j6T1rM3X025132; + Thu, 28 Jul 2005 19:53:22 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j6T1rMcT025131; + Thu, 28 Jul 2005 19:53:22 -0600 (MDT) (envelope-from mfuhr) +Date: Thu, 28 Jul 2005 19:53:22 -0600 +From: Michael Fuhr +To: Karim Nassar +Cc: pgsql-performance@postgresql.org +Subject: Re: Two queries are better than one? +Message-ID: <20050729015322.GA25003@winnie.fuhr.org> +References: <1122591866.11860.11.camel@localhost.localdomain> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1122591866.11860.11.camel@localhost.localdomain> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/450 +X-Sequence-Number: 13691 + +On Thu, Jul 28, 2005 at 04:04:25PM -0700, Karim Nassar wrote: +> I ran into a situation today maintaining someone else's code where the +> sum time running 2 queries seems to be faster than 1. The original code +> was split into two queries. I thought about joining them, but +> considering the intelligence of my predecessor, I wanted to test it. +> +> The question is, which technique is really faster? Is there some hidden +> setup cost I don't see with explain analyze? + +To see which technique will be faster in your application, time the +application code. The queries you show are taking fractions of a +millisecond; the communications overhead of executing two queries +might make that technique significantly slower than just the server +execution time that EXPLAIN ANALYZE shows. + +-- +Michael Fuhr +http://www.fuhr.org/~mfuhr/ + +From pgsql-performance-owner@postgresql.org Thu Jul 28 23:01:11 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 079B4528F5 + for ; + Thu, 28 Jul 2005 23:01:09 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80494-05 + for ; + Fri, 29 Jul 2005 02:01:05 +0000 (GMT) +Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) + by svr1.postgresql.org (Postfix) with ESMTP id 4D17B5299F + for ; + Thu, 28 Jul 2005 23:01:00 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP + id <20050729020103m9100g6kese>; Fri, 29 Jul 2005 02:01:03 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 85DF256011; Thu, 28 Jul 2005 21:01:03 -0500 (CDT) +Received: from [192.168.1.12] (Jigglypuff.arbash-meinel.com [192.168.1.12]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 7F12456006; + Thu, 28 Jul 2005 21:00:59 -0500 (CDT) +Message-ID: <42E98DDD.5000505@arbash-meinel.com> +Date: Thu, 28 Jul 2005 21:01:01 -0500 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: karim.nassar@acm.org, + Postgresql Performance +Subject: Re: Two queries are better than one? +References: <1122591866.11860.11.camel@localhost.localdomain> +In-Reply-To: <1122591866.11860.11.camel@localhost.localdomain> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigAB99DF19056F44E02782CD13" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.044 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/451 +X-Sequence-Number: 13692 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigAB99DF19056F44E02782CD13 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Karim Nassar wrote: +> I ran into a situation today maintaining someone else's code where the +> sum time running 2 queries seems to be faster than 1. The original code +> was split into two queries. I thought about joining them, but +> considering the intelligence of my predecessor, I wanted to test it. +> +> The question is, which technique is really faster? Is there some hidden +> setup cost I don't see with explain analyze? + +Yes, the time it takes your user code to parse the result, and create +the new query. :) + +It does seem like you are taking an extra 0.1ms for the combined query, +but that means you don't have another round trip to the database. So +that would mean one less context switch, and you don't need to know what +the cli_code is before you can get the cli_name. + +I would guess the overhead is the time for postgres to parse out the +text, place another index query, and then combine the rows. It seems +like this shouldn't take 0.1ms, but then again, that isn't very long. + +Also, did you run it *lots* of times to make sure that this isn't just +noise? + +John +=:-> + +> +> Postgres 7.4.7, Redhat AES 3 +> +> Each query individually: +> +> test=> explain analyze +> test-> select * from order WHERE ord_batch='343B' AND ord_id='12-645'; +> QUERY PLAN +> ---------------------------------------------------------------------------------------------------------------------------- +> Index Scan using order_pkey on order (cost=0.00..6.02 rows=1 width=486) (actual time=0.063..0.066 rows=1 loops=1) +> Index Cond: ((ord_batch = '343B'::bpchar) AND (ord_id = '12-645'::bpchar)) +> Total runtime: 0.172 ms +> (3 rows) +> +> +> test=> explain analyze +> test-> select cli_name from client where cli_code='1837'; +> QUERY PLAN +> --------------------------------------------------------------------------------------------------------------------- +> Index Scan using client_pkey on client (cost=0.00..5.98 rows=2 width=39) (actual time=0.043..0.047 rows=1 loops=1) +> Index Cond: (cli_code = '1837'::bpchar) +> Total runtime: 0.112 ms +> (3 rows) +> +> Joined: +> +> test=> explain analyze +> test-> SELECT cli_name,order.* +> test-> FROM order +> test-> JOIN client ON (ord_client = cli_code) +> test-> WHERE ord_batch='343B' AND ord_id='12-645'; +> QUERY PLAN +> ---------------------------------------------------------------------------------------------------------------------------------- +> Nested Loop (cost=0.00..12.00 rows=2 width=525) (actual time=0.120..0.128 rows=1 loops=1) +> -> Index Scan using order_pkey on order (cost=0.00..6.02 rows=1 width=486) (actual time=0.064..0.066 rows=1 loops=1) +> Index Cond: ((ord_batch = '343B'::bpchar) AND (ord_id = '12-645'::bpchar)) +> -> Index Scan using client_pkey on client (cost=0.00..5.98 rows=1 width=51) (actual time=0.023..0.026 rows=1 loops=1) +> Index Cond: ("outer".ord_client = client.cli_code) +> Total runtime: 0.328 ms +> (6 rows) +> +> + + +--------------enigAB99DF19056F44E02782CD13 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.0 (Darwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC6Y3eJdeBCYSNAAMRAvTBAKDC2CENfXNdYiCbQ5RjQ/M4tlnIOQCfVFaK +CSN0dsCFMpgB4e/eXMTqFmA= +=Nvyw +-----END PGP SIGNATURE----- + +--------------enigAB99DF19056F44E02782CD13-- + +From pgsql-performance-owner@postgresql.org Thu Jul 28 23:04:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5BC89528CC + for ; + Thu, 28 Jul 2005 23:04:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83168-08 + for ; + Fri, 29 Jul 2005 02:04:10 +0000 (GMT) +Received: from veggie-fuel.com (veggie-fuel.com [200.46.208.238]) + by svr1.postgresql.org (Postfix) with ESMTP id 1628E529B3 + for ; + Thu, 28 Jul 2005 23:04:08 -0300 (ADT) +Received: from localhost (unknown [200.46.204.144]) + by veggie-fuel.com (Postfix) with ESMTP id 2A81435F9DE + for ; + Fri, 29 Jul 2005 02:04:12 +0000 (GMT) +Received: from veggie-fuel.com ([200.46.208.238]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81961-08; Fri, 29 Jul 2005 02:04:02 +0000 (GMT) +Received: from [10.0.0.7] (63-228-143-68.phnx.qwest.net [63.228.143.68]) + by veggie-fuel.com (Postfix) with ESMTP id DCB4A35F9D6; + Fri, 29 Jul 2005 02:04:03 +0000 (GMT) +Subject: Re: Two queries are better than one? +From: Karim Nassar +Reply-To: karim.nassar@acm.org +To: John A Meinel +Cc: Postgresql Performance +In-Reply-To: <42E98DDD.5000505@arbash-meinel.com> +References: <1122591866.11860.11.camel@localhost.localdomain> + <42E98DDD.5000505@arbash-meinel.com> +Content-Type: text/plain +Date: Thu, 28 Jul 2005 19:02:13 -0700 +Message-Id: <1122602533.11862.35.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.034 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/452 +X-Sequence-Number: 13693 + +On Thu, 2005-07-28 at 21:01 -0500, John A Meinel wrote: +> +> Also, did you run it *lots* of times to make sure that this isn't just +> noise? + +If a dozen is lots, yes. :-) + +It was very consistent as I repeatedly ran it. + +-- +Karim Nassar + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 00:57:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E5ACB52840 + for ; + Fri, 29 Jul 2005 00:57:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14607-05 + for ; + Fri, 29 Jul 2005 03:57:31 +0000 (GMT) +Received: from linuxworld.com.au (unknown [203.34.46.50]) + by svr1.postgresql.org (Postfix) with ESMTP id 0788852816 + for ; + Fri, 29 Jul 2005 00:57:29 -0300 (ADT) +Received: from linuxworld.com.au (IDENT:swm@localhost.localdomain [127.0.0.1]) + by linuxworld.com.au (8.13.2/8.13.2) with ESMTP id j6T3vG6D010635; + Fri, 29 Jul 2005 13:57:17 +1000 +Received: from localhost (swm@localhost) + by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id + j6T3vFZ9010632; Fri, 29 Jul 2005 13:57:16 +1000 +X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs +Date: Fri, 29 Jul 2005 13:57:15 +1000 (EST) +From: Gavin Sherry +X-X-Sender: swm@linuxworld.com.au +To: Matthew Schumacher +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +In-Reply-To: <42E9749F.6000709@aptalaska.net> +Message-ID: +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/453 +X-Sequence-Number: 13694 + +On Thu, 28 Jul 2005, Matthew Schumacher wrote: + +> Karim Nassar wrote: +> > On Wed, 2005-07-27 at 14:35 -0800, Matthew Schumacher wrote: +> > +> > +> >>I put the rest of the schema up at +> >>http://www.aptalaska.net/~matt.s/bayes/bayes_pg.sql in case someone +> >>needs to see it too. +> > +> > +> > Do you have sample data too? +> > +> +> Ok, I finally got some test data together so that others can test +> without installing SA. +> +> The schema and test dataset is over at +> http://www.aptalaska.net/~matt.s/bayes/bayesBenchmark.tar.gz +> +> I have a pretty fast machine with a tuned postgres and it takes it about +> 2 minutes 30 seconds to load the test data. Since the test data is the +> bayes information on 616 spam messages than comes out to be about 250ms +> per message. While that is doable, it does add quite a bit of overhead +> to the email system. + +I had a look at your data -- thanks. + +I have a question though: put_token() is invoked 120596 times in your +benchmark... for 616 messages. That's nearly 200 queries (not even +counting the 1-8 (??) inside the function itself) per message. Something +doesn't seem right there.... + +Gavin + +From pgsql-performance-owner@postgresql.org Fri Jul 29 01:03:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 82B1D5281B + for ; + Fri, 29 Jul 2005 01:03:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14318-06 + for ; + Fri, 29 Jul 2005 04:03:30 +0000 (GMT) +Received: from mail.Mi8.com (unknown [63.240.6.46]) + by svr1.postgresql.org (Postfix) with ESMTP id 31FD952B3E + for ; + Fri, 29 Jul 2005 01:03:26 -0300 (ADT) +Received: from 172.16.1.118 by mail.Mi8.com with ESMTP (- GW05 Welcome + to Mi8 Corporation www.Mi8.com); Fri, 29 Jul 2005 00:03:21 -0400 +X-Server-Uuid: E0C866E6-C6CD-48B5-AE61-E57E73CF3CC7 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 29 Jul + 2005 00:03:21 -0400 +Received: from 24.5.173.15 ([24.5.173.15]) 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, 29 Jul + 2005 00:03:20 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Thu, 28 Jul 2005 21:03:20 -0700 +Subject: Re: [PATCHES] COPY FROM performance improvements +From: "Luke Lonergan" +To: "Joshua D. Drake" , + "Mark Wong" +Cc: "Patrick Welche" , + pgsql-performance@postgresql.org, maryedie@osdl.org +Message-ID: +In-Reply-To: <42E970E4.4010902@commandprompt.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 29 Jul 2005 04:03:21.0606 (UTC) + FILETIME=[75B48260:01C593F2] +X-WSS-ID: 6EF775031M815823967-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, hits=1.569 tagged_above=0 required=5 tests=AWL, + RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/454 +X-Sequence-Number: 13695 + +>>> Can you post the "time dd if=/dev/zero of=bigfile bs=8k count=500000" +>>> results? Also do the reverse (read the file) with "time dd if=bigfile +>>> of=/dev/null bs=8k". +> +> I didn't see this come across before... here ya go: +> +> time dd if=/dev/zero of=bigfile bs=8k count=500000 +> +> 500000+0 records in +> 500000+0 records out +> +> real 1m52.738s +> user 0m0.310s +> sys 0m36.590s + +So, that's 35MB/s, or 1/2 of a single disk drive. + +> time dd if=bigfile of=/dev/null bs=8k +> +> time dd if=bigfile of=/dev/null bs=8k +> 500000+0 records in +> 500000+0 records out +> +> real 4m38.742s +> user 0m0.320s +> sys 0m27.870s + +And that's 14MB/s, or < 1/4 of a single disk drive. + +> FYI on your hardware raid comment... I easily get 50 megs a second on my +> 3ware controllers and faster on my LSI SATA controllers. + +Then you are almost getting one disk worth of bandwidth. + +By comparison, we get this using Linux software RAID on Xeon or Opteron: + +$ time dd if=/dev/zero of=bigfile bs=8k count=500000 +500000+0 records in +500000+0 records out + +real 0m26.927s +user 0m0.074s +sys 0m8.769s + +$ time dd if=bigfile of=/dev/null bs=8k +500000+0 records in +500000+0 records out + +real 0m28.190s +user 0m0.039s +sys 0m8.349s + +with less CPU usage than HW SCSI RAID controllers. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 01:06:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 41D5652862 + for ; + Fri, 29 Jul 2005 01:06:21 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12253-10 + for ; + Fri, 29 Jul 2005 04:06:19 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.200]) + by svr1.postgresql.org (Postfix) with ESMTP id B532952816 + for ; + Fri, 29 Jul 2005 01:06:17 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id z6so339988nzd + for ; + Thu, 28 Jul 2005 21:06:17 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=TUEV79VD8e9JTcb1p4513QPlPedvJehLd0PCsSd6RIs0lKNS64sb+pEE1rkvE/rkOVHY1BVxMxf+jxC9E7edJt1XhVF2N1AkU2a2Esk5t6wZNQedyzQzU73lRqXDGFLp8aHPmGVi88D4Mc3N1JxjDev2XjeiR8WUaeJrnoZoNxY= +Received: by 10.36.36.10 with SMTP id j10mr2380637nzj; + Thu, 28 Jul 2005 21:05:40 -0700 (PDT) +Received: by 10.36.119.19 with HTTP; Thu, 28 Jul 2005 21:05:40 -0700 (PDT) +Message-ID: +Date: Fri, 29 Jul 2005 09:35:40 +0530 +From: Gnanavel S +Reply-To: Gnanavel S +To: Chris Travers +Subject: Re: Left joining against two empty tables makes a query SLOW +Cc: pgsql-performance@postgresql.org +In-Reply-To: <42E90E19.3030702@travelamericas.com> +Mime-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_8056_14123843.1122609940529" +References: <42E86A03.1070803@travelamericas.com> + + <42E90E19.3030702@travelamericas.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.435 tagged_above=0 required=5 tests=AWL, HTML_50_60, + HTML_MESSAGE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/455 +X-Sequence-Number: 13696 + +------=_Part_8056_14123843.1122609940529 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +On 7/28/05, Chris Travers wrote: +>=20 +> Gnanavel S wrote: +>=20 +> > +> > +> > vacuum & reindex the department and project table as the planner +> > expects there are 1060 rows but actually returning nothing. +>=20 +> I guess I should have mentioned that I have been vacuuming and +> reindexing at least once a week, and I did so just before running this=20 +> test. +> Normally I do: +> vacuum analyze; +> reindex database ....; + + +reindex the tables separately. + +Secondly, the project table has *never* had anything in it. So where +> are these numbers coming from? + + +pg_statistics=20 + +Best Wishes, +> Chris Travers +> Metatron Technology Consulting +>=20 + + + +--=20 +with regards, +S.Gnanavel +Satyam Computer Services Ltd. + +------=_Part_8056_14123843.1122609940529 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +

On 7/28/05, Chris Travers <c= +hris@travelamericas.com> wrote:
+Gnanavel S wrote:

>
>
> vacuum & reindex the depa= +rtment and project table as the planner
> expects there are 1060 rows= + but actually returning nothing.

I guess I should have mentioned tha= +t I have been vacuuming and +
reindexing at least once a week, and I did so just before running this = +test.
Normally I do:
vacuum analyze;
reindex database ....;

+reindex the tables separately.
+

Secondl= +y, the project table has *never* had anything in it.  So whereare these numbers coming from? +

+pg_statistics
+

Best Wi= +shes,
Chris Travers
Metatron Technology Consulting
+


--
with regards,
S.Gnanavel
Satyam Comp= +uter Services Ltd. + +------=_Part_8056_14123843.1122609940529-- + +From pgsql-performance-owner@postgresql.org Fri Jul 29 01:07:31 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6210852939 + for ; + Fri, 29 Jul 2005 01:07:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17986-01 + for ; + Fri, 29 Jul 2005 04:07:23 +0000 (GMT) +Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) + by svr1.postgresql.org (Postfix) with ESMTP id BBF6952932 + for ; + Fri, 29 Jul 2005 01:07:21 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D1)); Fri, 29 Jul 2005 00:06:59 -0400 +X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 29 Jul + 2005 00:07:13 -0400 +Received: from 24.5.173.15 ([24.5.173.15]) 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, 29 Jul + 2005 00:07:13 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Thu, 28 Jul 2005 21:07:12 -0700 +Subject: Re: [PATCHES] COPY FROM performance improvements +From: "Luke Lonergan" +To: "Mark Wong" +Cc: "Joshua D. Drake" , + "Patrick Welche" , + pgsql-performance@postgresql.org, maryedie@osdl.org +Message-ID: +In-Reply-To: <200507282343.j6SNhEjA013300@smtp.osdl.org> +MIME-Version: 1.0 +X-OriginalArrivalTime: 29 Jul 2005 04:07:13.0620 (UTC) + FILETIME=[FFFF0940:01C593F2] +X-WSS-ID: 6EF774E92B48094506-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, hits=1.593 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/456 +X-Sequence-Number: 13697 + +Mark, + +On 7/28/05 4:43 PM, "Mark Wong" wrote: + +> Are there any recommendations for Qlogic controllers on Linux, scsi or +> fiber channel? I might be able to my hands on some. I have pci-x slots +> for AMD, Itanium, or POWER5 if the architecture makes a difference. + +I don't have a recommendation for a particular one, it's been too long +(1998) since I've used one with Linux. However, I'd like to see a +comparison between Emulex and Qlogic and a winner chosen. We've had some +apparent driver issues with a client running Emulex on Linux, even using +many different versions of the kernel. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 01:12:30 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E617652825 + for ; + Fri, 29 Jul 2005 01:12:29 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17890-01 + for ; + Fri, 29 Jul 2005 04:12:28 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.202]) + by svr1.postgresql.org (Postfix) with ESMTP id A3D0C52816 + for ; + Fri, 29 Jul 2005 01:12:26 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id z6so340693nzd + for ; + Thu, 28 Jul 2005 21:12:26 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=msI83EWGX0bxbMwMVT/loWZGAPMC1Dy8MfnswBjdR61ko5EDGBND1Jfst2aSiEtGaq1xeqzGhu9o6gqjpodhw8NzScR80oHQutMqkn4SrJHT47polFp98hZYgh2SkPC3om9WDiVSvaBy0qAR4Qrf1PTjdrhOoiwOgDFccvw9rsY= +Received: by 10.36.252.6 with SMTP id z6mr1565962nzh; + Thu, 28 Jul 2005 21:11:31 -0700 (PDT) +Received: by 10.36.119.19 with HTTP; Thu, 28 Jul 2005 21:11:31 -0700 (PDT) +Message-ID: +Date: Fri, 29 Jul 2005 09:41:31 +0530 +From: Gnanavel S +Reply-To: Gnanavel S +To: karim.nassar@acm.org +Subject: Re: Two queries are better than one? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1122591866.11860.11.camel@localhost.localdomain> +Mime-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_8088_21102920.1122610291112" +References: <1122591866.11860.11.camel@localhost.localdomain> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.414 tagged_above=0 required=5 tests=AWL, HTML_40_50, + HTML_MESSAGE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/457 +X-Sequence-Number: 13698 + +------=_Part_8088_21102920.1122610291112 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +On 7/29/05, Karim Nassar wrote: +>=20 +> I ran into a situation today maintaining someone else's code where the +> sum time running 2 queries seems to be faster than 1. The original code +> was split into two queries. I thought about joining them, but +> considering the intelligence of my predecessor, I wanted to test it. +>=20 +> The question is, which technique is really faster? Is there some hidden +> setup cost I don't see with explain analyze? +>=20 +> Postgres 7.4.7, Redhat AES 3 +>=20 +> Each query individually: +>=20 +> test=3D> explain analyze +> test-> select * from order WHERE ord_batch=3D'343B' AND ord_id=3D'12-645'= +; +> QUERY PLAN +>=20 +> -------------------------------------------------------------------------= +--------------------------------------------------- +> Index Scan using order_pkey on order (cost=3D0.00..6.02 rows=3D1 width=3D= +486)=20 +> (actual time=3D0.063..0.066 rows=3D1 loops=3D1) +> Index Cond: ((ord_batch =3D '343B'::bpchar) AND (ord_id =3D '12-645'::bpc= +har)) +> Total runtime: 0.172 ms +> (3 rows) +>=20 +>=20 +> test=3D> explain analyze +> test-> select cli_name from client where cli_code=3D'1837'; +> QUERY PLAN +>=20 +> -------------------------------------------------------------------------= +-------------------------------------------- +> Index Scan using client_pkey on client (cost=3D0.00..5.98 rows=3D2 width= +=3D39)=20 +> (actual time=3D0.043..0.047 rows=3D1 loops=3D1) +> Index Cond: (cli_code =3D '1837'::bpchar) +> Total runtime: 0.112 ms +> (3 rows) +>=20 +> Joined: +>=20 +> test=3D> explain analyze +> test-> SELECT cli_name,order.* +> test-> FROM order +> test-> JOIN client ON (ord_client =3D cli_code) +> test-> WHERE ord_batch=3D'343B' AND ord_id=3D'12-645'; + + +where is the cli_code condition in the above query? + +QUERY PLAN +>=20 +> -------------------------------------------------------------------------= +--------------------------------------------------------- +> Nested Loop (cost=3D0.00..12.00 rows=3D2 width=3D525) (actual time=3D0.12= +0..0.128rows=3D1 loops=3D1) +> -> Index Scan using order_pkey on order (cost=3D0.00..6.02 rows=3D1 width= +=3D486)=20 +> (actual time=3D0.064..0.066 rows=3D1 loops=3D1) +> Index Cond: ((ord_batch =3D '343B'::bpchar) AND (ord_id =3D '12-645'::bpc= +har)) +> -> Index Scan using client_pkey on client (cost=3D0.00..5.98 rows=3D1=20 +> width=3D51) (actual time=3D0.023..0.026 rows=3D1 loops=3D1) +> Index Cond: ("outer".ord_client =3D client.cli_code) +> Total runtime: 0.328 ms +> (6 rows) +>=20 +>=20 +> -- +> Karim Nassar +>=20 +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend +>=20 + + + +--=20 +with regards, +S.Gnanavel +Satyam Computer Services Ltd. + +------=_Part_8088_21102920.1122610291112 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +

On 7/29/05, Karim Nassar <karim.= +nassar@acm.org> wrote:
+I ran into a situation today maintaining someone else's code where the
s= +um time running 2 queries seems to be faster than 1. The original code
w= +as split into two queries. I thought about joining them, but
considering= + the intelligence of my predecessor, I wanted to test it. +

The question is, which technique is really faster? Is there some hi= +dden
setup cost I don't see with explain analyze?

Postgres 7.4.7,= + Redhat AES 3

Each query individually:

test=3D> explain an= +alyze +
test-> select * from order  WHERE ord_batch=3D'343B' AND o= +rd_id=3D'12-645';
         = +            &nb= +sp;            = +            &nb= +sp;          +QUERY PLAN
-------------------------------------------------------------= +---------------------------------------------------------------
Index S= +can using order_pkey on order  (cost=3D0.00..6.02 rows=3D1 width= +=3D486) (actual time=3D +0.063..0.066 rows=3D1 loops=3D1)
   Index Cond: ((ord_batch = +=3D '343B'::bpchar) AND (ord_id =3D '12-645'::bpchar))
Total runtime: 0= +.172 ms
(3 rows)


test=3D> explain analyze
test->&nbs= +p;    select cli_name from client where cli_code=3D'1837'; +
            = +;            &n= +bsp;            = +;            &n= +bsp;   +QUERY PLAN
-------------------------------------------------------------= +--------------------------------------------------------
Index Scan usi= +ng client_pkey on client  (cost=3D0.00..5.98 rows=3D2 width=3D39)= + (actual time=3D +0.043..0.047 rows=3D1 loops=3D1)
   Index Cond: (cli_code =3D = +'1837'::bpchar)
Total runtime: 0.112 ms
(3 rows)

Joined:
<= +br>test=3D> explain analyze
test->    SELECT c= +li_name,order.*
test->        = +;       FROM order +
test->          &n= +bsp;    +JOIN client ON (ord_client =3D cli_code)
test->   &nbs= +p;          WHERE +ord_batch=3D'343B' AND ord_id=3D'12-645';

+where is the cli_code condition in the above query?

&= +nbsp;           &nbs= +p;            &= +nbsp;           &nbs= +p;            &= +nbsp;         QUERY +PLAN
-------------------------------------------------------------------= +---------------------------------------------------------------
Nested = +Loop  (cost=3D0.00..12.00 rows=3D2 width=3D525) (actual time=3D0.= +120..0.128 rows=3D1 loops=3D1) +
   +->  Index Scan using order_pkey on +order  (cost=3D0.00..6.02 rows=3D1 width=3D486) (actual +time=3D0.064..0.066 rows=3D1 loops=3D1)
     &n= +bsp;   Index Cond: ((ord_batch =3D '343B'::bpchar) AND (ord_id = +=3D '12-645'::bpchar))
   +->  Index Scan using client_pkey on +client  (cost=3D0.00..5.98 rows=3D1 width=3D51) (actual +time=3D0.023..0.026 rows=3D1 loops=3D1)
     &n= +bsp;   Index Cond: ("outer".ord_client =3D client.cli_c= +ode)
Total runtime: 0.328 ms
(6 rows)


--
Karim Nassar = +<karim.nassar@acm.org +>


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



--
with regards,
S.Gnanavel
Satya= +m Computer Services Ltd. + +------=_Part_8088_21102920.1122610291112-- + +From pgsql-performance-owner@postgresql.org Fri Jul 29 01:23:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BC668529B7 + for ; + Fri, 29 Jul 2005 01:23:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20792-01 + for ; + Fri, 29 Jul 2005 04:23:24 +0000 (GMT) +Received: from veggie-fuel.com (veggie-fuel.com [200.46.208.238]) + by svr1.postgresql.org (Postfix) with ESMTP id 75B66529B4 + for ; + Fri, 29 Jul 2005 01:23:23 -0300 (ADT) +Received: from localhost (unknown [200.46.204.144]) + by veggie-fuel.com (Postfix) with ESMTP id E2A9C35F9DE + for ; + Fri, 29 Jul 2005 04:23:23 +0000 (GMT) +Received: from veggie-fuel.com ([200.46.208.238]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18957-03; Fri, 29 Jul 2005 04:23:21 +0000 (GMT) +Received: from [10.0.0.7] (63-228-143-68.phnx.qwest.net [63.228.143.68]) + by veggie-fuel.com (Postfix) with ESMTP id 46CC735F9D6; + Fri, 29 Jul 2005 04:23:21 +0000 (GMT) +Subject: Re: Two queries are better than one? +From: Karim Nassar +Reply-To: karim.nassar@acm.org +To: Gnanavel S +Cc: pgsql-performance@postgresql.org +In-Reply-To: +References: <1122591866.11860.11.camel@localhost.localdomain> + +Content-Type: text/plain +Date: Thu, 28 Jul 2005 21:21:38 -0700 +Message-Id: <1122610899.11862.63.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.029 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/458 +X-Sequence-Number: 13699 + +On Fri, 2005-07-29 at 09:41 +0530, Gnanavel S wrote: + +> +> Joined: +> +> test=> explain analyze +> test-> SELECT cli_name,order.* +> test-> FROM order +> test-> JOIN client ON (ord_client = cli_code) +> test-> WHERE ord_batch='343B' AND +> ord_id='12-645'; +> +> where is the cli_code condition in the above query? + +I don't understand the question. ord_client is the client code, and +cli_code is the client code, for their respective tables. batch/id is +unique, so there is only one record from order, and only one client to +associate. + +Clearer? + +-- +Karim Nassar + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 01:25:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 640CB529B7 + for ; + Fri, 29 Jul 2005 01:25:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18999-06 + for ; + Fri, 29 Jul 2005 04:25:05 +0000 (GMT) +Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) + by svr1.postgresql.org (Postfix) with ESMTP id 31704529B4 + for ; + Fri, 29 Jul 2005 01:25:02 -0300 (ADT) +Received: from localhost (mailbox.samurai.com [205.207.28.82]) + by mailbox.samurai.com (Postfix) with ESMTP id 9A7602394CF; + Fri, 29 Jul 2005 00:25:02 -0400 (EDT) +Received: from mailbox.samurai.com ([205.207.28.82]) + by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, + port 10024) + with LMTP id 83867-01-4; Fri, 29 Jul 2005 00:25:01 -0400 (EDT) +Received: from [61.88.101.19] (unknown [61.88.101.19]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mailbox.samurai.com (Postfix) with ESMTP id EC129239519; + Fri, 29 Jul 2005 00:24:59 -0400 (EDT) +Message-ID: <42E9AFF5.50209@samurai.com> +Date: Fri, 29 Jul 2005 14:26:29 +1000 +From: Neil Conway +User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Gnanavel S +Cc: Chris Travers , pgsql-performance@postgresql.org +Subject: Re: Left joining against two empty tables makes a query +References: <42E86A03.1070803@travelamericas.com> + + <42E90E19.3030702@travelamericas.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 mailbox.samurai.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.016 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/459 +X-Sequence-Number: 13700 + +Gnanavel S wrote: +> reindex the tables separately. + +Reindexing should not affect this problem, anyway. + +-Neil + +From pgsql-performance-owner@postgresql.org Fri Jul 29 01:39:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E824552B4F + for ; + Fri, 29 Jul 2005 01:39:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18912-10 + for ; + Fri, 29 Jul 2005 04:39:26 +0000 (GMT) +Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.194]) + by svr1.postgresql.org (Postfix) with ESMTP id 53DEE52B4A + for ; + Fri, 29 Jul 2005 01:39:23 -0300 (ADT) +Received: by zproxy.gmail.com with SMTP id z6so343758nzd + for ; + Thu, 28 Jul 2005 21:39:23 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=C1JPfgFGU/zmYZ0Hbmgw0IhfIeR52GFGPBNzamg/bvYTDNzb5Ly7PKIr270oqYGHF8YOVguYkn6HCnE3JFUgEJUdzaPpqrqOHN2lxUjlz1X/Lql5u3Ba/GBELbtq8muWZ2WZebmp6ia7HXFQy9lHLYw4+6so4/87CSqBOhUvyok= +Received: by 10.37.22.3 with SMTP id z3mr2408679nzi; + Thu, 28 Jul 2005 21:38:49 -0700 (PDT) +Received: by 10.36.119.19 with HTTP; Thu, 28 Jul 2005 21:38:49 -0700 (PDT) +Message-ID: +Date: Fri, 29 Jul 2005 10:08:49 +0530 +From: Gnanavel S +Reply-To: Gnanavel S +To: karim.nassar@acm.org +Subject: Re: Two queries are better than one? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1122610899.11862.63.camel@localhost.localdomain> +Mime-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_8206_18523250.1122611929124" +References: <1122591866.11860.11.camel@localhost.localdomain> + + <1122610899.11862.63.camel@localhost.localdomain> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.403 tagged_above=0 required=5 tests=AWL, HTML_50_60, + HTML_MESSAGE, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200507/460 +X-Sequence-Number: 13701 + +------=_Part_8206_18523250.1122611929124 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +On 7/29/05, Karim Nassar wrote: +>=20 +> On Fri, 2005-07-29 at 09:41 +0530, Gnanavel S wrote: +>=20 +> > +> > Joined: +> > +> > test=3D> explain analyze +> > test-> SELECT cli_name,order.* +> > test-> FROM order +> > test-> JOIN client ON (ord_client =3D cli_code) +> > test-> WHERE ord_batch=3D'343B' AND +> > ord_id=3D'12-645'; +> > +> > where is the cli_code condition in the above query? +>=20 +> I don't understand the question. ord_client is the client code, and +> cli_code is the client code, for their respective tables. batch/id is +> unique, so there is only one record from order, and only one client to +> associate. +>=20 +> Clearer? + + +ok. + +Reason might be comparing with a literal value (previous case) is cheaper= +=20 +than comparing with column(as it has to be evaluated). But with the previou= +s=20 +case getting and assigning the cli_code in the application and executing in= +=20 +db will be time consuming as it includes IPC cost. + +-- +> Karim Nassar +>=20 +>=20 + + +--=20 +with regards, +S.Gnanavel +Satyam Computer Services Ltd. + +------=_Part_8206_18523250.1122611929124 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +

On 7/29/05, Karim Nassar <karim.= +nassar@acm.org> wrote:
+On Fri, 2005-07-29 at 09:41 +0530, Gnanavel S wrote:

>
>&nb= +sp;        Joined:
>
> = +        test=3D> explain analyze
&= +gt;         test->  &n= +bsp; SELECT cli_name,order.*
>     &nbs= +p;   +test->           = +    +FROM order
>         +test->           = +    +JOIN client ON (ord_client =3D cli_code)
>    &nb= +sp;    +test->           = +   WHERE +ord_batch=3D'343B' AND
>       &nb= +sp; ord_id=3D'12-645';
>
> where is the cli_code condition in t= +he above query?

I don't understand the question. ord_client is the c= +lient code, and
cli_code is the client code, for their respective tables= +. batch/id is +
unique, so there is only one record from order, and only one client to<= +br>associate.

Clearer?

+ok.
+
+ Reason might be comparing with a literal value (previous case) is +cheaper than comparing with column(as it has to be evaluated).  +But with the previous case getting and assigning the cli_code in the +application and executing in db will be time consuming as it includes +IPC cost.
+
+
--
Karim= + Nassar <karim.nassar@acm.org +>




--
with regard= +s,
S.Gnanavel
Satyam Computer Services Ltd. + +------=_Part_8206_18523250.1122611929124-- + +From pgsql-performance-owner@postgresql.org Fri Jul 29 02:10:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DF14B5283C + for ; + Fri, 29 Jul 2005 02:10:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28131-05 + for ; + Fri, 29 Jul 2005 05:10:24 +0000 (GMT) +Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) + by svr1.postgresql.org (Postfix) with ESMTP id DF9EA52831 + for ; + Fri, 29 Jul 2005 02:10:20 -0300 (ADT) +Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net + [64.4.232.33]) (authenticated bits=0) + by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j6T5NYQO005229 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); + Thu, 28 Jul 2005 21:23:35 -0800 +Message-ID: <42E9BA2F.1090900@aptalaska.net> +Date: Thu, 28 Jul 2005 21:10:07 -0800 +From: Matthew Schumacher +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Gavin Sherry +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + +In-Reply-To: +X-Enigmail-Version: 0.91.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Spam-Bayes: Learn: ham +X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/461 +X-Sequence-Number: 13702 + +Gavin Sherry wrote: + +> +> I had a look at your data -- thanks. +> +> I have a question though: put_token() is invoked 120596 times in your +> benchmark... for 616 messages. That's nearly 200 queries (not even +> counting the 1-8 (??) inside the function itself) per message. Something +> doesn't seem right there.... +> +> Gavin + +I am pretty sure that's right because it is doing word statistics on +email messages. + +I need to spend some time studying the code, I just haven't found time yet. + +Would it be safe to say that there isn't any glaring performance +penalties other than the sheer volume of queries? + +Thanks, + +schu + +From pgsql-performance-owner@postgresql.org Fri Jul 29 02:23:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3932E52968 + for ; + Fri, 29 Jul 2005 02:23:21 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31920-10 + for ; + Fri, 29 Jul 2005 05:23:17 +0000 (GMT) +Received: from mail.travelamericas.com (unknown [206.130.134.147]) + by svr1.postgresql.org (Postfix) with SMTP id 6C191528D2 + for ; + Fri, 29 Jul 2005 02:23:16 -0300 (ADT) +Received: (qmail 12915 invoked from network); 29 Jul 2005 05:23:16 -0000 +Received: from unknown (HELO ?10.0.0.253?) (10.0.0.253) + by verkiel.travelamericas.com with SMTP; 29 Jul 2005 05:23:16 -0000 +Message-ID: <42E9BD43.6060203@travelamericas.com> +Date: Thu, 28 Jul 2005 22:23:15 -0700 +From: Chris Travers +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Gnanavel S +Cc: Chris Travers , pgsql-performance@postgresql.org +Subject: Re: Left joining against two empty tables makes a query +References: <42E86A03.1070803@travelamericas.com> + + <42E90E19.3030702@travelamericas.com> + +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/462 +X-Sequence-Number: 13703 + + +> +> Secondly, the project table has *never* had anything in it. So where +> are these numbers coming from? +> +> +> pg_statistics + +I very much doubt that. I was unable to locate any rows in pg_statistic +where the pg_class.oid for either table matched any row's starelid. + +Tom's argument that this is behavior by design makes sense. I assumed +that something like that had to be going on, otherwise there would be +nowhere for the numbers to come from. I.e. if there never were any rows +in the table, then if pg_statistic is showing 1060 rows, we have bigger +problems than a bad query plan. I hope however that eventually tables +which are truly empty can be treated intelligently sometime in the +future in Left Joins. Otherwise this limits the usefulness of out of +the box solutions which may have functionality that we don't use. Such +solutions can then kill the database performance quite easily. + +Chris Travers +Metatron Technology Consulting + +From pgsql-performance-owner@postgresql.org Fri Jul 29 02:50:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BE56552825 + for ; + Fri, 29 Jul 2005 02:50:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40532-02 + for ; + Fri, 29 Jul 2005 05:50:15 +0000 (GMT) +Received: from mail1.catalyst.net.nz (godel.catalyst.net.nz [202.78.240.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 79D035282E + for ; + Fri, 29 Jul 2005 02:50:13 -0300 (ADT) +Received: from leibniz.catalyst.net.nz ([202.78.240.7] + helo=lamb.mcmillan.net.nz) by mail1.catalyst.net.nz with esmtpsa + (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.50) + id 1DyNl6-0004VQ-Ho; Fri, 29 Jul 2005 17:50:12 +1200 +Received: from lamb.mcmillan.net.nz (lamb.mcmillan.net.nz [127.0.0.1]) + by lamb.mcmillan.net.nz (Postfix) with ESMTP id 2200D5B8006; + Fri, 29 Jul 2005 17:50:12 +1200 (NZST) +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +From: Andrew McMillan +To: Matthew Schumacher +Cc: pgsql-performance@postgresql.org +In-Reply-To: <42E9749F.6000709@aptalaska.net> +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-91YWh4BVVTMDV4QRW/zg" +Date: Fri, 29 Jul 2005 17:50:11 +1200 +Message-Id: <1122616211.5691.340.camel@lamb.mcmillan.net.nz> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/463 +X-Sequence-Number: 13704 + + +--=-91YWh4BVVTMDV4QRW/zg +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +On Thu, 2005-07-28 at 16:13 -0800, Matthew Schumacher wrote: +>=20 +> Ok, I finally got some test data together so that others can test +> without installing SA. +>=20 +> The schema and test dataset is over at +> http://www.aptalaska.net/~matt.s/bayes/bayesBenchmark.tar.gz +>=20 +> I have a pretty fast machine with a tuned postgres and it takes it about +> 2 minutes 30 seconds to load the test data. Since the test data is the +> bayes information on 616 spam messages than comes out to be about 250ms +> per message. While that is doable, it does add quite a bit of overhead +> to the email system. + +On my laptop this takes: + +real 1m33.758s +user 0m4.285s +sys 0m1.181s + +One interesting effect is the data in bayes_vars has a huge number of +updates and needs vacuum _frequently_. After the run a vacuum full +compacts it down from 461 pages to 1 page. + +Regards, + Andrew. + +------------------------------------------------------------------------- +Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington +WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St +DDI: +64(4)803-2201 MOB: +64(272)DEBIAN OFFICE: +64(4)499-2267 + I don't do it for the money. + -- Donald Trump, Art of the Deal + +------------------------------------------------------------------------- + + +--=-91YWh4BVVTMDV4QRW/zg +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (GNU/Linux) + +iD8DBQBC6cOTjJA0f48GgBIRAoDGAJ46aWRNT5DpkFeA0vPBOfn6CPcesACeLj4T +v51QgQ+CZI5hJVrtZsm39IY= +=VAB8 +-----END PGP SIGNATURE----- + +--=-91YWh4BVVTMDV4QRW/zg-- + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 02:58:43 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E3B425282E + for ; + Fri, 29 Jul 2005 02:58:42 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40064-07 + for ; + Fri, 29 Jul 2005 05:58:32 +0000 (GMT) +Received: from linuxworld.com.au (unknown [203.34.46.50]) + by svr1.postgresql.org (Postfix) with ESMTP id 249BE52825 + for ; + Fri, 29 Jul 2005 02:58:30 -0300 (ADT) +Received: from linuxworld.com.au (IDENT:swm@localhost.localdomain [127.0.0.1]) + by linuxworld.com.au (8.13.2/8.13.2) with ESMTP id j6T5wOss011092; + Fri, 29 Jul 2005 15:58:24 +1000 +Received: from localhost (swm@localhost) + by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id + j6T5wOfv011089; Fri, 29 Jul 2005 15:58:24 +1000 +X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs +Date: Fri, 29 Jul 2005 15:58:24 +1000 (EST) +From: Gavin Sherry +X-X-Sender: swm@linuxworld.com.au +To: Matthew Schumacher +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +In-Reply-To: <42E9BA2F.1090900@aptalaska.net> +Message-ID: +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + + <42E9BA2F.1090900@aptalaska.net> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/464 +X-Sequence-Number: 13705 + +zOn Thu, 28 Jul 2005, Matthew Schumacher wrote: + +> Gavin Sherry wrote: +> +> > +> > I had a look at your data -- thanks. +> > +> > I have a question though: put_token() is invoked 120596 times in your +> > benchmark... for 616 messages. That's nearly 200 queries (not even +> > counting the 1-8 (??) inside the function itself) per message. Something +> > doesn't seem right there.... +> > +> > Gavin +> +> I am pretty sure that's right because it is doing word statistics on +> email messages. +> +> I need to spend some time studying the code, I just haven't found time yet. +> +> Would it be safe to say that there isn't any glaring performance +> penalties other than the sheer volume of queries? + +Well, everything relating to one message should be issued in a transaction +block. Secondly, the initial select may be unnecessary -- I haven't looked +at the logic that closely. + +There is, potentially, some parser overhead. In C, you could get around +this with PQprepare() et al. + +It would also be interesting to look at the cost of a C function. + +Gavin + +From pgsql-performance-owner@postgresql.org Fri Jul 29 03:49:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A04AE52ABE + for ; + Fri, 29 Jul 2005 03:49:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 49971-09 + for ; + Fri, 29 Jul 2005 06:48:51 +0000 (GMT) +Received: from zigo.dhs.org (ua-83-227-204-174.cust.bredbandsbolaget.se + [83.227.204.174]) + by svr1.postgresql.org (Postfix) with ESMTP id 0041152815 + for ; + Fri, 29 Jul 2005 03:48:50 -0300 (ADT) +Received: from zigo.zigo.dhs.org (zigo.zigo.dhs.org [192.168.0.1]) + by zigo.dhs.org (Postfix) with ESMTP + id 6CDC78467; Fri, 29 Jul 2005 08:48:48 +0200 (CEST) +Date: Fri, 29 Jul 2005 08:48:48 +0200 (CEST) +From: Dennis Bjorklund +To: Matthew Schumacher +Cc: josh@agliodbs.com, +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +In-Reply-To: <42E83C09.2040508@aptalaska.net> +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=ISO-8859-1 +Content-Transfer-Encoding: 8BIT +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.422 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200507/465 +X-Sequence-Number: 13706 + +On Wed, 27 Jul 2005, Matthew Schumacher wrote: + +> Then they do this to insert the token: +> +> INSERT INTO bayes_token ( +> id, +> token, +> spam_count, +> ham_count, +> atime +> ) VALUES ( +> ?, +> ?, +> ?, +> ?, +> ? +> ) ON DUPLICATE KEY +> UPDATE +> spam_count = GREATEST(spam_count + ?, 0), +> ham_count = GREATEST(ham_count + ?, 0), +> atime = GREATEST(atime, ?) +> +> Or update the token: +> +> UPDATE bayes_vars SET +> $token_count_update +> newest_token_age = GREATEST(newest_token_age, ?), +> oldest_token_age = LEAST(oldest_token_age, ?) +> WHERE id = ? +> +> +> I think the reason why the procedure was written for postgres was +> because of the greatest and least statements performing poorly. + +How can they perform poorly when they are dead simple? Here are 2 +functions that work for the above cases of greatest: + +CREATE FUNCTION greatest_int (integer, integer) + RETURNS INTEGER + IMMUTABLE STRICT + AS 'SELECT CASE WHEN $1 < $2 THEN $2 ELSE $1 END;' + LANGUAGE SQL; + +CREATE FUNCTION least_int (integer, integer) + RETURNS INTEGER + IMMUTABLE STRICT + AS 'SELECT CASE WHEN $1 < $2 THEN $1 ELSE $2 END;' + LANGUAGE SQL; + +and these should be inlined by pg and very fast to execute. + +I wrote a function that should do what the insert above does. The update +I've not looked at (I don't know what $token_count_update is) but the +update looks simple enough to just implement the same way in pg as in +mysql. + +For the insert or replace case you can probably use this function: + +CREATE FUNCTION insert_or_update_token (xid INTEGER, + xtoken BYTEA, + xspam_count INTEGER, + xham_count INTEGER, + xatime INTEGER) +RETURNS VOID AS +$$ +BEGIN + LOOP + UPDATE bayes_token + SET spam_count = greatest_int (spam_count + xspam_count, 0), + ham_count = greatest_int (ham_count + xham_count, 0), + atime = greatest_int (atime, xatime) + WHERE id = xid + AND token = xtoken; + + IF found THEN + RETURN; + END IF; + + BEGIN + INSERT INTO bayes_token VALUES (xid, + xtoken, + xspam_count, + xham_count, + xatime); + RETURN; + EXCEPTION WHEN unique_violation THEN + -- do nothing + END; + END LOOP; +END; +$$ +LANGUAGE plpgsql; + +It's not really tested so I can't tell if it's faster then what you have. +What it does do is mimic the way you insert values in mysql. It only work +on pg 8.0 and later however since the exception handling was added in 8.0. + +-- +/Dennis Bj�rklund + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 04:01:27 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9464B52AC7 + for ; + Fri, 29 Jul 2005 04:01:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52624-05 + for ; + Fri, 29 Jul 2005 07:01:17 +0000 (GMT) +Received: from mail.Mi8.com (unknown [63.240.6.42]) + by svr1.postgresql.org (Postfix) with ESMTP id 5CDFF52ABE + for ; + Fri, 29 Jul 2005 04:01:15 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- GW01 Welcome + to Mi8 Corporation www.Mi8.com); Fri, 29 Jul 2005 03:01:07 -0400 +X-Server-Uuid: F1A2E19A-84E4-48DD-8F48-B475613F58B2 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 29 Jul + 2005 03:01:07 -0400 +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: Re: Performance problems testing with Spamassassin +Date: Fri, 29 Jul 2005 03:01:07 -0400 +Message-ID: <3E37B936B592014B978C4415F90D662D0C4221@MI8NYCMAIL06.Mi8.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Performance problems testing with Spamassassin + 3.1.0 +Thread-Index: AcWUAmWmvDU/LT66SYiCywCdDqFp2wABvk4+ +From: "Luke Lonergan" +To: "Andrew McMillan" , + "Matthew Schumacher" +Cc: pgsql-performance@postgresql.org +X-OriginalArrivalTime: 29 Jul 2005 07:01:07.0562 (UTC) + FILETIME=[4B1C3CA0:01C5940B] +X-WSS-ID: 6EF70BB921S3163737-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, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/466 +X-Sequence-Number: 13707 + +work_mem =3D 131072 # min 64, size in KB +shared_buffers =3D 16000 # min 16, at least max_connections*2, = +8KB each +checkpoint_segments =3D 128 # in logfile segments, min 1, 16MB = +each +effective_cache_size =3D 750000 # typically 8KB each +fsync=3Dfalse # turns forced synchronization on or = +off +=20 +------------------------------------------ +On Bizgres (0_7_2) running on a 2GHz Opteron: +------------------------------------------ +[llonergan@stinger4 bayesBenchmark]$ ./test.sh + +real 0m38.348s +user 0m1.422s +sys 0m1.870s +=20 +------------------------------------------ +On a 2.4GHz AMD64: +------------------------------------------ +[llonergan@kite15 bayesBenchmark]$ ./test.sh + +real 0m35.497s +user 0m2.250s +sys 0m0.470s +=20 +Now we turn fsync=3Dtrue: +=20 +------------------------------------------ +On a 2.4GHz AMD64: +------------------------------------------ +[llonergan@kite15 bayesBenchmark]$ ./test.sh + +real 2m7.368s +user 0m2.560s +sys 0m0.750s +=20 +I guess we see the real culprit here. Anyone surprised it's the WAL? +=20 +- Luke + +________________________________ + +From: pgsql-performance-owner@postgresql.org on behalf of Andrew = +McMillan +Sent: Thu 7/28/2005 10:50 PM +To: Matthew Schumacher +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Performance problems testing with Spamassassin = +3.1.0 + + + +On Thu, 2005-07-28 at 16:13 -0800, Matthew Schumacher wrote: +> +> Ok, I finally got some test data together so that others can test +> without installing SA. +> +> The schema and test dataset is over at +> http://www.aptalaska.net/~matt.s/bayes/bayesBenchmark.tar.gz +> +> I have a pretty fast machine with a tuned postgres and it takes it = +about +> 2 minutes 30 seconds to load the test data. Since the test data is = +the +> bayes information on 616 spam messages than comes out to be about = +250ms +> per message. While that is doable, it does add quite a bit of = +overhead +> to the email system. + +On my laptop this takes: + +real 1m33.758s +user 0m4.285s +sys 0m1.181s + +One interesting effect is the data in bayes_vars has a huge number of +updates and needs vacuum _frequently_. After the run a vacuum full +compacts it down from 461 pages to 1 page. + +Regards, + Andrew. + +-------------------------------------------------------------------------= + +Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington +WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St +DDI: +64(4)803-2201 MOB: +64(272)DEBIAN OFFICE: +64(4)499-2267 + I don't do it for the money. + -- Donald Trump, Art of the Deal + +-------------------------------------------------------------------------= + + + + + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 09:37:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E5031529B4 + for ; + Fri, 29 Jul 2005 09:37:18 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28595-04 + for ; + Fri, 29 Jul 2005 12:37:14 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) + by svr1.postgresql.org (Postfix) with ESMTP id AAEC9529A2 + for ; + Fri, 29 Jul 2005 09:37:09 -0300 (ADT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id j6TCb0A10838; + Fri, 29 Jul 2005 08:37:00 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200507291237.j6TCb0A10838@candle.pha.pa.us> +Subject: Re: [PATCHES] COPY FROM performance improvements +In-Reply-To: +To: Luke Lonergan +Date: Fri, 29 Jul 2005 08:37:00 -0400 (EDT) +Cc: Mark Wong , "Joshua D. Drake" , + Patrick Welche , + pgsql-performance@postgresql.org, maryedie@osdl.org +X-Mailer: ELM [version 2.4ME+ PL121 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/467 +X-Sequence-Number: 13708 + +Luke Lonergan wrote: +> Mark, +> +> On 7/28/05 4:43 PM, "Mark Wong" wrote: +> +> > Are there any recommendations for Qlogic controllers on Linux, scsi or +> > fiber channel? I might be able to my hands on some. I have pci-x slots +> > for AMD, Itanium, or POWER5 if the architecture makes a difference. +> +> I don't have a recommendation for a particular one, it's been too long +> (1998) since I've used one with Linux. However, I'd like to see a +> comparison between Emulex and Qlogic and a winner chosen. We've had some +> apparent driver issues with a client running Emulex on Linux, even using +> many different versions of the kernel. + +Where is the most recent version of the COPY patch? + +-- + Bruce Momjian | http://candle.pha.pa.us + pgman@candle.pha.pa.us | (610) 359-1001 + + If your life is a hard drive, | 13 Roberts Road + + Christ can be your backup. | Newtown Square, Pennsylvania 19073 + +From pgsql-bugs-owner@postgresql.org Fri Jul 29 10:11:28 2005 +X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0EEDB529BD + for ; + Fri, 29 Jul 2005 09:56:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 32818-03 + for ; + Fri, 29 Jul 2005 12:56:49 +0000 (GMT) +Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) + by svr1.postgresql.org (Postfix) with ESMTP id 176DC52998 + for ; Fri, 29 Jul 2005 09:56:49 -0300 (ADT) +Received: by svr2.postgresql.org (Postfix, from userid 80) + id 1166CF0B14; Fri, 29 Jul 2005 13:52:45 +0100 (BST) +To: pgsql-bugs@postgresql.org +Subject: BUG #1797: Problem using Limit in a function, seqscan +From: "Magno Leite" +Message-Id: <20050729125245.1166CF0B14@svr2.postgresql.org> +Date: Fri, 29 Jul 2005 13:52:45 +0100 (BST) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/248 +X-Sequence-Number: 12411 + + +The following bug has been logged online: + +Bug reference: 1797 +Logged by: Magno Leite +Email address: magnomilk@yahoo.com.br +PostgreSQL version: 8.0 +Operating system: Windows XP Professional Edition +Description: Problem using Limit in a function, seqscan +Details: + +I looked for about this problem in BUG REPORT but I can't find. This is my +problem, when I try to use limit in a function, the Postgre doesn't use my +index, then it use sequencial scan. What is the problem ? + +From pgsql-performance-owner@postgresql.org Fri Jul 29 10:23:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A5B5B529C0 + for ; + Fri, 29 Jul 2005 10:23:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38219-08 + for ; + Fri, 29 Jul 2005 13:23:05 +0000 (GMT) +Received: from mr2.surnet.cl (smtp2.surnet.cl [216.155.73.163]) + by svr1.postgresql.org (Postfix) with ESMTP id 15D3952939 + for ; + Fri, 29 Jul 2005 10:23:04 -0300 (ADT) +Received: from smtp2.surnet.cl (216.155.73.169) by mr2.surnet.cl (7.0.031.3) + id 4259ADFA0191741E; Fri, 29 Jul 2005 09:21:47 -0400 +Received: from smtp1.surnet.cl (smtp1.surnet.cl []) + by mr2.surnet.cl ([216.155.73.169]); Fri, 29 Jul 2005 13:21:47 +0000 +Received: from cluster.surnet.cl (216.155.73.164) by smtp1.surnet.cl + (7.0.031.3) id 42587C6E012F051D; Fri, 29 Jul 2005 09:21:38 -0400 +Received: from alvh.no-ip.org (200.85.218.66) by cluster.surnet.cl (7.0.043) + (authenticated as alvherre@surnet.cl) + id 42B3EF60005D5F25; Fri, 29 Jul 2005 09:22:17 -0400 +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id 7426DC2D450; Fri, 29 Jul 2005 09:23:19 -0400 (CLT) +Date: Fri, 29 Jul 2005 09:23:19 -0400 +From: Alvaro Herrera +To: Luke Lonergan +Cc: Andrew McMillan , + Matthew Schumacher , pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin +Message-ID: <20050729132319.GA13680@alvh.no-ip.org> +Mail-Followup-To: Luke Lonergan , + Andrew McMillan , + Matthew Schumacher , + pgsql-performance@postgresql.org +References: <3E37B936B592014B978C4415F90D662D0C4221@MI8NYCMAIL06.Mi8.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <3E37B936B592014B978C4415F90D662D0C4221@MI8NYCMAIL06.Mi8.com> +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.427 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, RCVD_IN_NJABL_PROXY +X-Spam-Level: * +X-Archive-Number: 200507/468 +X-Sequence-Number: 13709 + +On Fri, Jul 29, 2005 at 03:01:07AM -0400, Luke Lonergan wrote: + +> I guess we see the real culprit here. Anyone surprised it's the WAL? + +So what? Are you planning to suggest people to turn fsync=false? + +I just had a person lose 3 days of data on some tables because of that, +even when checkpoints were 5 minutes apart. With fsync off, there's no +work _at all_ going on, not just the WAL -- heap/index file fsync at +checkpoint is also skipped. This is no good. + +-- +Alvaro Herrera () +"In a specialized industrial society, it would be a disaster +to have kids running around loose." (Paul Graham) + +From pgsql-bugs-owner@postgresql.org Fri Jul 29 11:00:44 2005 +X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9EB53529F6 + for ; + Fri, 29 Jul 2005 11:00:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48716-05 + for ; + Fri, 29 Jul 2005 14:00:40 +0000 (GMT) +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by svr1.postgresql.org (Postfix) with ESMTP id D3935529F3 + for ; Fri, 29 Jul 2005 11:00:38 -0300 (ADT) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j6TE0dhM029609 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Fri, 29 Jul 2005 08:00:42 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j6TE0c4k083725; + Fri, 29 Jul 2005 08:00:38 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j6TE0cNO083724; + Fri, 29 Jul 2005 08:00:38 -0600 (MDT) (envelope-from mfuhr) +Date: Fri, 29 Jul 2005 08:00:38 -0600 +From: Michael Fuhr +To: Magno Leite +Cc: pgsql-bugs@postgresql.org +Subject: Re: BUG #1797: Problem using Limit in a function, seqscan +Message-ID: <20050729140038.GA83653@winnie.fuhr.org> +References: <20050729125245.1166CF0B14@svr2.postgresql.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050729125245.1166CF0B14@svr2.postgresql.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/249 +X-Sequence-Number: 12412 + +On Fri, Jul 29, 2005 at 01:52:45PM +0100, Magno Leite wrote: +> I looked for about this problem in BUG REPORT but I can't find. This is my +> problem, when I try to use limit in a function, the Postgre doesn't use my +> index, then it use sequencial scan. What is the problem ? + +Without more information we can only guess, but if you're using +PL/pgSQL then a cached query plan might be responsible. Here's an +excerpt from the PREPARE documentation: + + In some situations, the query plan produced for a prepared + statement will be inferior to the query plan that would have + been chosen if the statement had been submitted and executed + normally. This is because when the statement is planned and + the planner attempts to determine the optimal query plan, the + actual values of any parameters specified in the statement are + unavailable. PostgreSQL collects statistics on the distribution + of data in the table, and can use constant values in a statement + to make guesses about the likely result of executing the + statement. Since this data is unavailable when planning prepared + statements with parameters, the chosen plan may be suboptimal. + +If you'd like us to take a closer look, then please post a self- +contained example, i.e., all SQL statements that somebody could +load into an empty database to reproduce the behavior you're seeing. + +-- +Michael Fuhr +http://www.fuhr.org/~mfuhr/ + +From pgsql-bugs-owner@postgresql.org Fri Jul 29 11:05:44 2005 +X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 00B8052A1D + for ; + Fri, 29 Jul 2005 11:05:41 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47813-08 + for ; + Fri, 29 Jul 2005 14:05:35 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.197.194]) + by svr1.postgresql.org (Postfix) with SMTP id 3CCF3529F1 + for ; Fri, 29 Jul 2005 11:05:34 -0300 (ADT) +Received: (qmail 23844 invoked by uid 500); 29 Jul 2005 14:06:42 -0000 +Date: Fri, 29 Jul 2005 09:06:42 -0500 +From: Bruno Wolff III +To: Magno Leite +Cc: pgsql-bugs@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: BUG #1797: Problem using Limit in a function, seqscan +Message-ID: <20050729140642.GA23650@wolff.to> +Mail-Followup-To: pgsql-performance@postgresql.org, + Bruno Wolff III , + Magno Leite +References: <20050729125245.1166CF0B14@svr2.postgresql.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20050729125245.1166CF0B14@svr2.postgresql.org> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/250 +X-Sequence-Number: 12413 + +On Fri, Jul 29, 2005 at 13:52:45 +0100, + Magno Leite wrote: +> +> Description: Problem using Limit in a function, seqscan +> +> I looked for about this problem in BUG REPORT but I can't find. This is my +> problem, when I try to use limit in a function, the Postgre doesn't use my +> index, then it use sequencial scan. What is the problem ? + +You haven't described the problem well enough to allow us to help you and +you posted it to the wrong list. This should be discussed on the performance +list, not the bug list. + +It would help if you showed us the query you are running and run it outside +of the function with EXPLAIN ANALYSE and show us that output. Depending +on what that output shows, we may ask you other questions. + +From pgsql-performance-owner@postgresql.org Fri Jul 29 11:12:58 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A4011529A2 + for ; + Fri, 29 Jul 2005 11:12:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47206-10 + for ; + Fri, 29 Jul 2005 14:12:54 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 44E18529A5 + for ; + Fri, 29 Jul 2005 11:12:53 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6TECkuX016615; + Fri, 29 Jul 2005 10:12:47 -0400 (EDT) +To: "Luke Lonergan" +Cc: "Andrew McMillan" , + "Matthew Schumacher" , + pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin +In-reply-to: <3E37B936B592014B978C4415F90D662D0C4221@MI8NYCMAIL06.Mi8.com> +References: <3E37B936B592014B978C4415F90D662D0C4221@MI8NYCMAIL06.Mi8.com> +Comments: In-reply-to "Luke Lonergan" + message dated "Fri, 29 Jul 2005 03:01:07 -0400" +Date: Fri, 29 Jul 2005 10:12:46 -0400 +Message-ID: <16614.1122646366@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/470 +X-Sequence-Number: 13711 + +"Luke Lonergan" writes: +> I guess we see the real culprit here. Anyone surprised it's the WAL? + +You have not proved that at all. + +I haven't had time to look at Matthew's problem, but someone upthread +implied that it was doing a separate transaction for each word. If so, +collapsing that to something more reasonable (say one xact per message) +would probably help a great deal. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jul 29 13:45:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 309E152A23 + for ; + Fri, 29 Jul 2005 13:45:25 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87426-03 + for ; + Fri, 29 Jul 2005 16:45:15 +0000 (GMT) +Received: from mail2.aeccom.com (port-212-202-101-158.static.qsc.de + [212.202.101.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 42B6A52A01 + for ; + Fri, 29 Jul 2005 13:45:13 -0300 (ADT) +Received: from [192.168.2.12] (port-83-236-156-26.static.qsc.de + [83.236.156.26]) by mail2.aeccom.com (Postfix) with ESMTP + id DA7AE10B; Fri, 29 Jul 2005 18:45:12 +0200 (CEST) +Message-ID: <42EA5D18.9020204@aeccom.com> +Date: Fri, 29 Jul 2005 18:45:12 +0200 +From: =?ISO-8859-1?Q?Dirk_Lutzeb=E4ck?= +Organization: AEC/communications GmbH +User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Cc: Sven Geisler +Subject: Performance problems on 4/8way Opteron (dualcore) HP DL585 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.063 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/471 +X-Sequence-Number: 13712 + +Hi, + +does anybody have expierence with this machine (4x 875 dual core Opteron +CPUs)? We run RHEL 3.0, 32bit and under high load it is a drag. We +mostly run memory demanding queries. Context switches are pretty much +around 20.000 on the average, no cs spikes when we run many processes in +parallel. Actually we only see two processes in running state! When +there are only a few processes running context switches go much higher. +At the moment we are much slower that with a 4way XEON box (DL580). + +We are running 8.0.3 compiled with -mathlon flags. + +Regards, + +Dirk + +From pgsql-performance-owner@postgresql.org Fri Jul 29 13:46:22 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5A2AF52A23 + for ; + Fri, 29 Jul 2005 13:46:20 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88356-01 + for ; + Fri, 29 Jul 2005 16:46:17 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 654D8529F3 + for ; + Fri, 29 Jul 2005 13:46:11 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7670117; Fri, 29 Jul 2005 09:48:24 -0700 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin +Date: Fri, 29 Jul 2005 09:47:03 -0700 +User-Agent: KMail/1.8 +Cc: "Luke Lonergan" , + "Andrew McMillan" , + "Matthew Schumacher" +References: <3E37B936B592014B978C4415F90D662D0C4221@MI8NYCMAIL06.Mi8.com> +In-Reply-To: <3E37B936B592014B978C4415F90D662D0C4221@MI8NYCMAIL06.Mi8.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200507290947.03700.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/472 +X-Sequence-Number: 13713 + +Luke, + +> work_mem = 131072 # min 64, size in KB + +Incidentally, this is much too high for an OLTP application, although I don't +think this would have affected the test. + +> shared_buffers = 16000 # min 16, at least max_connections*2, 8KB +> each checkpoint_segments = 128 # in logfile segments, min 1, 16MB +> each effective_cache_size = 750000 # typically 8KB each +> fsync=false # turns forced synchronization on or off + +Try changing: +wal_buffers = 256 + +and try Bruce's stop full_page_writes patch. + +> I guess we see the real culprit here. Anyone surprised it's the WAL? + +Nope. On high-end OLTP stuff, it's crucial that the WAL have its own +dedicated disk resource. + +Also, running a complex stored procedure for each and every word in each +e-mail is rather deadly ... with the e-mail traffic our server at Globix +receives, for example, that would amount to running it about 1,000 times a +minute. It would be far better to batch this, somehow, maybe using temp +tables. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Jul 29 13:50:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B1DE75281A + for ; + Fri, 29 Jul 2005 13:50:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 86050-10 + for ; + Fri, 29 Jul 2005 16:49:54 +0000 (GMT) +Received: from mail1.fluidhosting.com (mail1.fluidhosting.com [204.14.90.61]) + by svr1.postgresql.org (Postfix) with SMTP id 584A852B1D + for ; + Fri, 29 Jul 2005 13:49:53 -0300 (ADT) +Received: (qmail 8574 invoked by uid 399); 29 Jul 2005 16:49:52 -0000 +Received: from 194-185-112-82.f5.ngi.it (HELO ?10.20.20.4?) (194.185.112.82) + by mail1.fluidhosting.com with SMTP; 29 Jul 2005 16:49:52 -0000 +Message-ID: <42EA5E64.6050209@beccati.com> +Date: Fri, 29 Jul 2005 18:50:44 +0200 +From: Matteo Beccati +User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: ltree <@ operator selectivity causes very slow plan +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/473 +X-Sequence-Number: 13714 + +Hi, + +I'm happily using ltree since a long time, but I'm recently having +troubles because of ltree <@ operator selectivity that is causing very +bad planner choices. + +An example of slow query is: + +SELECT + batch_id, + b.t_stamp AS t_stamp, + objects, + CASE WHEN sent IS NULL THEN gw_batch_sent(b.batch_id) ELSE sent END +AS sent +FROM + gw_users u JOIN gw_batches b USING (u_id) +WHERE + u.tree <@ '1041' AND + b.t_stamp >= 'today'::date - '7 days'::interval AND + b.t_stamp < 'today' +ORDER BY + t_stamp DESC; + +I've posted the EXPLAIN ANALYZE output here for better readability: +http://rafb.net/paste/results/NrCDMs50.html + +As you may see, disabling nested loops makes the query lightning fast. + + +The problem is caused by the fact that most of the records of gw_users +match the "u.tree <@ '1041'" condition: + +SELECT COUNT(*) FROM gw_users; + count +------- + 5012 + +SELECT COUNT(*) FROM gw_users WHERE tree <@ '1041'; + count +------- + 4684 + +Is there anything I can do apart from disabling nested loops? + + +Best regards +-- +Matteo Beccati +http://phpadsnew.com +http://phppgads.com + +From pgsql-performance-owner@postgresql.org Fri Jul 29 14:11:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6E32B52B51 + for ; + Fri, 29 Jul 2005 14:11:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91578-10 + for ; + Fri, 29 Jul 2005 17:11:20 +0000 (GMT) +Received: from mail.Mi8.com (unknown [63.240.6.42]) + by svr1.postgresql.org (Postfix) with ESMTP id 5E44852A23 + for ; + Fri, 29 Jul 2005 14:11:19 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- GW01 Welcome + to Mi8 Corporation www.Mi8.com); Fri, 29 Jul 2005 13:11:10 -0400 +X-Server-Uuid: F1A2E19A-84E4-48DD-8F48-B475613F58B2 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 29 Jul + 2005 13:11:11 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 29 Jul + 2005 13:11:10 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Fri, 29 Jul 2005 10:11:10 -0700 +Subject: Re: Performance problems testing with Spamassassin +From: "Luke Lonergan" +To: "Alvaro Herrera" +Cc: "Andrew McMillan" , + "Matthew Schumacher" , + pgsql-performance@postgresql.org +Message-ID: +In-Reply-To: <20050729132319.GA13680@alvh.no-ip.org> +MIME-Version: 1.0 +X-OriginalArrivalTime: 29 Jul 2005 17:11:11.0273 (UTC) + FILETIME=[849F4990:01C59460] +X-WSS-ID: 6EF4BCA421S3436249-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, hits=1.552 tagged_above=0 required=5 tests=AWL, + RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/474 +X-Sequence-Number: 13715 + +Alvaro, + +On 7/29/05 6:23 AM, "Alvaro Herrera" wrote: + +> On Fri, Jul 29, 2005 at 03:01:07AM -0400, Luke Lonergan wrote: +> +>> I guess we see the real culprit here. Anyone surprised it's the WAL? +> +> So what? Are you planning to suggest people to turn fsync=false? + +That's not the conclusion I made, no. I was pointing out that fsync has a +HUGE impact on his problem, which implies something to do with the I/O sync +operations. Black box bottleneck hunt approach #12. + +> With fsync off, there's no +> work _at all_ going on, not just the WAL -- heap/index file fsync at +> checkpoint is also skipped. This is no good. + +OK - so that's what Tom is pointing out, that fsync impacts more than WAL. + +However, finding out that fsync/no fsync makes a 400% difference in speed +for this problem is interesting and relevant, no? + +- Luke + + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 14:14:00 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CCA6352936 + for ; + Fri, 29 Jul 2005 14:13:54 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92264-06 + for ; + Fri, 29 Jul 2005 17:13:52 +0000 (GMT) +Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) + by svr1.postgresql.org (Postfix) with ESMTP id 2C23A5282C + for ; + Fri, 29 Jul 2005 14:13:51 -0300 (ADT) +Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D1)); Fri, 29 Jul 2005 13:13:41 -0400 +X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 29 Jul + 2005 13:13:41 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 29 Jul + 2005 13:13:41 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Fri, 29 Jul 2005 10:13:41 -0700 +Subject: Re: Performance problems testing with Spamassassin +From: "Luke Lonergan" +To: "Tom Lane" +Cc: "Andrew McMillan" , + "Matthew Schumacher" , + pgsql-performance@postgresql.org +Message-ID: +In-Reply-To: <16614.1122646366@sss.pgh.pa.us> +MIME-Version: 1.0 +X-OriginalArrivalTime: 29 Jul 2005 17:13:41.0685 (UTC) + FILETIME=[DE465650:01C59460] +X-WSS-ID: 6EF4BC4F2B48612553-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, hits=1.577 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/475 +X-Sequence-Number: 13716 + +Tom, + +On 7/29/05 7:12 AM, "Tom Lane" wrote: + +> "Luke Lonergan" writes: +>> I guess we see the real culprit here. Anyone surprised it's the WAL? +> +> You have not proved that at all. + +As Alvaro pointed out, fsync has impact on more than WAL, so good point. +Interesting that fsync has such a huge impact on this situation though. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 14:38:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6558452A20 + for ; + Fri, 29 Jul 2005 14:38:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96143-07 + for ; + Fri, 29 Jul 2005 17:38:23 +0000 (GMT) +Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 7802E52A23 + for ; + Fri, 29 Jul 2005 14:38:22 -0300 (ADT) +Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net + [64.4.232.33]) (authenticated bits=0) + by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j6THpFCp012026 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); + Fri, 29 Jul 2005 09:51:15 -0800 +Message-ID: <42EA6966.8090402@aptalaska.net> +Date: Fri, 29 Jul 2005 09:37:42 -0800 +From: Matthew Schumacher +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Andrew McMillan +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> +In-Reply-To: <1122616211.5691.340.camel@lamb.mcmillan.net.nz> +X-Enigmail-Version: 0.91.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Spam-Bayes: Learn: ham +X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/477 +X-Sequence-Number: 13718 + +Andrew McMillan wrote: +> On Thu, 2005-07-28 at 16:13 -0800, Matthew Schumacher wrote: +> +>>Ok, I finally got some test data together so that others can test +>>without installing SA. +>> +>>The schema and test dataset is over at +>>http://www.aptalaska.net/~matt.s/bayes/bayesBenchmark.tar.gz +>> +>>I have a pretty fast machine with a tuned postgres and it takes it about +>>2 minutes 30 seconds to load the test data. Since the test data is the +>>bayes information on 616 spam messages than comes out to be about 250ms +>>per message. While that is doable, it does add quite a bit of overhead +>>to the email system. +> +> +> On my laptop this takes: +> +> real 1m33.758s +> user 0m4.285s +> sys 0m1.181s +> +> One interesting effect is the data in bayes_vars has a huge number of +> updates and needs vacuum _frequently_. After the run a vacuum full +> compacts it down from 461 pages to 1 page. +> +> Regards, +> Andrew. +> + +I wonder why your laptop is so much faster. My 2 min 30 sec test was +done on a dual xeon with a LSI megaraid with 128MB cache and writeback +caching turned on. + +Here are my memory settings: + +shared_buffers = 16384 +work_mem = 32768 +maintenance_work_mem = 65536 + +I tried higher values before I came back to these but it didn't help my +performance any. I should also mention that this is a production +database server that was servicing other queries when I ran this test. + +How often should this table be vacuumed, every 5 minutes? + +Also, this test goes a bit faster with sync turned off, if mysql isn't +using sync that would be why it's so much faster. Anyone know what the +default for mysql is? + +Thanks, +schu + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 14:35:26 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 62230529FF + for ; + Fri, 29 Jul 2005 14:35:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99330-01 + for ; + Fri, 29 Jul 2005 17:35:14 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id AAF7052936 + for ; + Fri, 29 Jul 2005 14:35:13 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7670303; Fri, 29 Jul 2005 10:37:27 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Dennis Bjorklund +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +Date: Fri, 29 Jul 2005 10:38:04 -0700 +User-Agent: KMail/1.8 +Cc: Matthew Schumacher , + pgsql-performance@postgresql.org +References: +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +Message-Id: <200507291038.04230.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/476 +X-Sequence-Number: 13717 + +Dennis, + +> =A0 =A0 =A0 EXCEPTION WHEN unique_violation THEN + +I seem to remember that catching an exception in a PL/pgSQL procedure was a= +=20 +large performance cost. It'd be better to do UPDATE ... IF NOT FOUND. + +=2D-=20 +=2D-Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Jul 29 14:43:34 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0E1F352A23 + for ; + Fri, 29 Jul 2005 14:43:33 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96143-09 + for ; + Fri, 29 Jul 2005 17:43:23 +0000 (GMT) +Received: from davinci.ethosmedia.com (server227.ethosmedia.com + [209.128.84.227]) + by svr1.postgresql.org (Postfix) with ESMTP id 109D952848 + for ; + Fri, 29 Jul 2005 14:43:22 -0300 (ADT) +X-EthosMedia-Virus-Scanned: no infections found +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 7670339; Fri, 29 Jul 2005 10:45:33 -0700 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Performance problems on 4/8way Opteron (dualcore) HP DL585 +Date: Fri, 29 Jul 2005 10:46:10 -0700 +User-Agent: KMail/1.8 +Cc: Dirk =?iso-8859-1?q?Lutzeb=E4ck?= , + Sven Geisler +References: <42EA5D18.9020204@aeccom.com> +In-Reply-To: <42EA5D18.9020204@aeccom.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200507291046.10318.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/478 +X-Sequence-Number: 13719 + +Dirk, + +> does anybody have expierence with this machine (4x 875 dual core Opteron +> CPUs)? + +Nope. I suspect that you may be the first person to report in on +dual-cores. There may be special compile issues with dual-cores that +we've not yet encountered. + +> We run RHEL 3.0, 32bit and under high load it is a drag. We +> mostly run memory demanding queries. Context switches are pretty much +> around 20.000 on the average, no cs spikes when we run many processes in +> parallel. Actually we only see two processes in running state! When +> there are only a few processes running context switches go much higher. +> At the moment we are much slower that with a 4way XEON box (DL580). + +Um, that was a bit incoherent. Are you seeing a CS storm or aren't you? + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Jul 29 14:54:35 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 53CB952986 + for ; + Fri, 29 Jul 2005 14:54:34 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 98850-10 + for ; + Fri, 29 Jul 2005 17:54:22 +0000 (GMT) +Received: from mail.Mi8.com (unknown [63.240.6.46]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D59852936 + for ; + Fri, 29 Jul 2005 14:54:20 -0300 (ADT) +Received: from 172.16.1.118 by mail.Mi8.com with ESMTP (- GW05 Welcome + to Mi8 Corporation www.Mi8.com); Fri, 29 Jul 2005 13:54:18 -0400 +X-Server-Uuid: E0C866E6-C6CD-48B5-AE61-E57E73CF3CC7 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 29 Jul + 2005 13:54:12 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 29 Jul + 2005 13:54:11 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Fri, 29 Jul 2005 10:54:08 -0700 +Subject: Re: [PATCHES] COPY FROM performance improvements +From: "Luke Lonergan" +To: "Bruce Momjian" +Cc: "Mark Wong" , "Joshua D. Drake" , + "Patrick Welche" , + pgsql-performance@postgresql.org, maryedie@osdl.org +Message-ID: +In-Reply-To: <200507291237.j6TCb0A10838@candle.pha.pa.us> +MIME-Version: 1.0 +X-OriginalArrivalTime: 29 Jul 2005 17:54:12.0426 (UTC) + FILETIME=[871BFAA0:01C59466] +X-WSS-ID: 6EF4B2CB1M816182486-03-01 +Content-Type: multipart/mixed; + boundary=B_3205479250_19305824 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.551 tagged_above=0 required=5 tests=AWL, + RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/479 +X-Sequence-Number: 13720 + +> This message is in MIME format. Since your mail reader does not understand +this format, some or all of this message may not be legible. + +--B_3205479250_19305824 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: 7bit + +Bruce, + +On 7/29/05 5:37 AM, "Bruce Momjian" wrote: + +> Where is the most recent version of the COPY patch? + +My direct e-mails aren't getting to you, they are trapped in a spam filter +on your end, so you didn't get my e-mail with the patch! + +I've attached it here, sorry to the list owner for the patch inclusion / +off-topic. + +- Luke + + +--B_3205479250_19305824 +Content-Type: application/octet-stream; + name=copy_parse_improvements_V15.patch.gz +Content-Disposition: attachment; filename=copy_parse_improvements_V15.patch.gz +Content-Transfer-Encoding: base64 + +H4sICCKt6UIAA2NvcHlfcGFyc2VfaW1wcm92ZW1lbnRzX1YxNS5wYXRjaADsPGt32zayn5Vf +AftuY8mmbEmW5NdN9ziy3GrXtVPZaXe36eGhKUjmhiJVPuy4bf77nQdAghQV223TdPfWp1Uk +EBgM5o3BgKNgIt8dijhyd64d960MJjtuOJ87wSSGL4v7bffZi1//92w8uBRTz5eHYmcRhf+W +bgLgb+MoDJOdxSz+wd/5A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9hF1s6GAL2hKcCx5o +MkpTcUy30EiGWE6iUPYPHTzksmOX7TnJk8JGxb02TFhyc6Oe12UQ5Jd0sfrP7BixKoVVFIFJ +mx+MpG2Ad9p+YKUFvoT9TV89CPZqib2jZt9P9e7r5idfRzQ3T0mHwUfQbeTcd/zosDsE/pY3 +YCNI2m0K84w3Uqqbl+4j/SZgiviXVDtfdosrf4k95uWdu8uLt/mPoi8UHuS9knQqMkvPr5/i ++qFnSwuoUF/pAiq6j+qi9/v4CPh3R0Qr/74UqRHUVWbfub3OwrUQ2PH5Df0k7/kfCzYlffYg +qeL/n9344n3aX/xxiXoxTqf39YzhsdJuVQDyUrwk0q6OBf5oB4RIy8u03HhUuzA4hSHoQdRg +FLIoOBNSm1EHA2Q9kMzNUDRLJKdWJBkGnnqhEthz5VHBPiB8rL0jv7RWZFppumzvMJHB7635 +FFrYCnoMxeyCnfD///8AC+cnr9E3AQA= + +--B_3205479250_19305824-- + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 15:30:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 173C852831 + for ; + Fri, 29 Jul 2005 15:30:06 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08997-05 + for ; + Fri, 29 Jul 2005 18:29:55 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id B70BA52833 + for ; + Fri, 29 Jul 2005 15:29:53 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050729182954m9200g4ujse>; Fri, 29 Jul 2005 18:29:54 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id ADDE556021; Fri, 29 Jul 2005 13:29:53 -0500 (CDT) +Received: from [192.168.1.11] (liliana.arbash-meinel.com [192.168.1.11]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 51AF756006; + Fri, 29 Jul 2005 13:29:49 -0500 (CDT) +Message-ID: <42EA759A.60807@arbash-meinel.com> +Date: Fri, 29 Jul 2005 13:29:46 -0500 +From: John Arbash Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: josh@agliodbs.com +Cc: Dennis Bjorklund , + Matthew Schumacher , pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: + <200507291038.04230.josh@agliodbs.com> +In-Reply-To: <200507291038.04230.josh@agliodbs.com> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig541C882B4147AB26BC6EC16A" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.147 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200507/480 +X-Sequence-Number: 13721 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig541C882B4147AB26BC6EC16A +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Josh Berkus wrote: + +>Dennis, +> +> +> +>> EXCEPTION WHEN unique_violation THEN +>> +>> +> +>I seem to remember that catching an exception in a PL/pgSQL procedure was a +>large performance cost. It'd be better to do UPDATE ... IF NOT FOUND. +> +> +> +Actually, he was doing an implicit UPDATE IF NOT FOUND in that he was doing: + +UPDATE + +IF found THEN return; + +INSERT +EXCEPT +... + +So really, the exception should never be triggered. +John +=:-> + + +--------------enig541C882B4147AB26BC6EC16A +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.5 (GNU/Linux) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC6nWcJdeBCYSNAAMRAvvHAJwPBkfZaj3d2C8AOyUIh1RoJlRCsQCeOFe7 +1Dh31ZIEpB4BDhNBSQ3iIgw= +=j02d +-----END PGP SIGNATURE----- + +--------------enig541C882B4147AB26BC6EC16A-- + +From pgsql-performance-owner@postgresql.org Fri Jul 29 15:56:07 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5A3C45293C + for ; + Fri, 29 Jul 2005 15:56:05 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14457-05 + for ; + Fri, 29 Jul 2005 18:55:56 +0000 (GMT) +Received: from gghcwest.com (adsl-71-128-90-172.dsl.pltn13.pacbell.net + [71.128.90.172]) + by svr1.postgresql.org (Postfix) with ESMTP id CC3C25281E + for ; + Fri, 29 Jul 2005 15:55:54 -0300 (ADT) +Received: from toonses.gghcwest.com (toonses.gghcwest.com [192.168.168.115]) + by gghcwest.com (8.12.10/8.12.9) with ESMTP id j6TItimd028952; + Fri, 29 Jul 2005 11:55:47 -0700 +Received: from jwb by toonses.gghcwest.com with local (Exim 4.50) + id 1Dya1H-0001nm-2f; Fri, 29 Jul 2005 11:55:43 -0700 +Subject: Re: Performance problems on 4/8way Opteron (dualcore) HP +From: "Jeffrey W. Baker" +To: josh@agliodbs.com +Cc: pgsql-performance@postgresql.org, + Dirk =?ISO-8859-1?Q?Lutzeb=E4ck?= , + Sven Geisler +In-Reply-To: <200507291046.10318.josh@agliodbs.com> +References: <42EA5D18.9020204@aeccom.com> + <200507291046.10318.josh@agliodbs.com> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Date: Fri, 29 Jul 2005 11:55:42 -0700 +Message-Id: <1122663342.6814.5.camel@toonses.gghcwest.com> +Mime-Version: 1.0 +X-Mailer: Evolution 2.3.6 +X-Virus-Scanned: by amavisd-new at hub.org +X-Archive-Number: 200507/481 +X-Sequence-Number: 13722 + +On Fri, 2005-07-29 at 10:46 -0700, Josh Berkus wrote: +> Dirk, +> +> > does anybody have expierence with this machine (4x 875 dual core Opteron +> > CPUs)? + +I'm using dual 275s without problems. + +> Nope. I suspect that you may be the first person to report in on +> dual-cores. There may be special compile issues with dual-cores that +> we've not yet encountered. + +Doubtful. However you could see improvements using recent Linux kernel +code. There have been some patches for optimizing scheduling and memory +allocations. + +However, if you are running this machine in 32-bit mode, why did you +bother paying $14,000 for your CPUs? You will get FAR better +performance in 64-bit mode. 64-bit mode will give you 30-50% better +performance on PostgreSQL loads, in my experience. Also, if I remember +correctly, the 32-bit x86 kernel doesn't understand Opteron NUMA +topology, so you may be seeing poor memory allocation decisions. + +-jwb + +> > We run RHEL 3.0, 32bit and under high load it is a drag. We +> > mostly run memory demanding queries. Context switches are pretty much +> > around 20.000 on the average, no cs spikes when we run many processes in +> > parallel. Actually we only see two processes in running state! When +> > there are only a few processes running context switches go much higher. +> > At the moment we are much slower that with a 4way XEON box (DL580). +> +> Um, that was a bit incoherent. Are you seeing a CS storm or aren't you? +> + +From pgsql-performance-owner@postgresql.org Fri Jul 29 16:02:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F123D5298C + for ; + Fri, 29 Jul 2005 16:02:46 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 16292-08 + for ; + Fri, 29 Jul 2005 19:02:42 +0000 (GMT) +Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) + by svr1.postgresql.org (Postfix) with ESMTP id CC35E52941 + for ; + Fri, 29 Jul 2005 16:02:40 -0300 (ADT) +Received: from 172.16.1.118 by mail.Mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D1)); Fri, 29 Jul 2005 15:02:31 -0400 +X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by + d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 29 Jul + 2005 15:02:31 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 29 Jul + 2005 15:02:30 -0500 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Fri, 29 Jul 2005 12:02:30 -0700 +Subject: Re: Performance problems testing with Spamassassin +From: "Luke Lonergan" +To: "Tom Lane" , + "Matthew Schumacher" +Cc: pgsql-performance@postgresql.org +Message-ID: +In-Reply-To: <20875.1122531559@sss.pgh.pa.us> +MIME-Version: 1.0 +X-OriginalArrivalTime: 29 Jul 2005 19:02:31.0074 (UTC) + FILETIME=[12180820:01C59470] +X-WSS-ID: 6EF4A2CD2B48673350-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, hits=1.576 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200507/482 +X-Sequence-Number: 13723 + +Tom, + +On 7/27/05 11:19 PM, "Tom Lane" wrote: + +> Matthew Schumacher writes: +>> After playing with various indexes and what not I simply am unable to +>> make this procedure perform any better. Perhaps someone on the list can +>> spot the bottleneck and reveal why this procedure isn't performing that +>> well or ways to make it better. +> +> There's not anything obviously wrong with that procedure --- all of the +> updates are on primary keys, so one would expect reasonably efficient +> query plans to get chosen. Perhaps it'd be worth the trouble to build +> the server with profiling enabled and get a gprof trace to see where the +> time is going. + +Yes - that would be excellent. We've used oprofile recently at Mark Wong's +suggestion, which doesn't require rebuilding the source. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 16:17:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E2579529E7 + for ; + Fri, 29 Jul 2005 16:17:00 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19748-04 + for ; + Fri, 29 Jul 2005 19:16:54 +0000 (GMT) +Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 8EDDE52917 + for ; + Fri, 29 Jul 2005 16:16:53 -0300 (ADT) +Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net + [64.4.232.33]) (authenticated bits=0) + by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j6TJUQ9k003626 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) + for ; Fri, 29 Jul 2005 11:30:27 -0800 +Message-ID: <42EA80A4.7070705@aptalaska.net> +Date: Fri, 29 Jul 2005 11:16:52 -0800 +From: Matthew Schumacher +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin +References: +In-Reply-To: +X-Enigmail-Version: 0.91.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Spam-Bayes: Learn: unavailable +X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/483 +X-Sequence-Number: 13724 + +Ok, + +Here is something new, when I take my data.sql file and add a begin and +commit at the top and bottom, the benchmark is a LOT slower? + +My understanding is that it should be much faster because fsync isn't +called until the commit instead of on every sql command. + +I must be missing something here. + +schu + +From pgsql-performance-owner@postgresql.org Fri Jul 29 16:22:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 926D952AB8 + for ; + Fri, 29 Jul 2005 16:21:57 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21752-07 + for ; + Fri, 29 Jul 2005 19:21:54 +0000 (GMT) +Received: from mx1.neopolitan.us (mx1.neopolitan.us [65.87.16.224]) + by svr1.postgresql.org (Postfix) with ESMTP id 0CADD52AC2 + for ; + Fri, 29 Jul 2005 16:21:53 -0300 (ADT) +Received: from [65.87.16.98] (HELO [10.0.0.221]) + by mx1.neopolitan.us (CommuniGate Pro SMTP 4.2.10) + with ESMTP id 10168090; Fri, 29 Jul 2005 12:21:54 -0700 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Fri, 29 Jul 2005 12:21:53 -0700 +Subject: Re: Performance problems on 4/8way Opteron (dualcore) +From: "J. Andrew Rogers" +To: , +Cc: Dirk Lutzeb=?ISO-8859-1?B?5A==?=ck , + Sven Geisler +Message-ID: +In-Reply-To: <200507291046.10318.josh@agliodbs.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, hits=1.312 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST +X-Spam-Level: * +X-Archive-Number: 200507/484 +X-Sequence-Number: 13725 + +On 7/29/05 10:46 AM, "Josh Berkus" wrote: +>> does anybody have expierence with this machine (4x 875 dual core Opteron +>> CPUs)? +> +> Nope. I suspect that you may be the first person to report in on +> dual-cores. There may be special compile issues with dual-cores that +> we've not yet encountered. + + +There was recently a discussion of similar types of problems on a couple of +the supercomputing lists, regarding surprisingly substandard performance +from large dual-core opteron installations. + +The problem as I remember it boiled down to the Linux kernel handling +memory/process management very badly on large dual core systems -- +pathological NUMA behavior. However, this problem has apparently been fixed +in Linux v2.6.12+, and using the more recent kernel on large dual core +systems generated *massive* performance improvements on these systems for +the individuals with this issue. Using the patched kernel, one gets the +performance most people were expecting. + +The v2.6.12+ kernels are a bit new, but they contain a very important +performance patch for systems like the one above. It would definitely be +worth testing if possible. + + +J. Andrew Rogers + + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 16:24:48 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D231652933 + for ; + Fri, 29 Jul 2005 16:24:44 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21892-04 + for ; + Fri, 29 Jul 2005 19:24:35 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 8FD9352A80 + for ; + Fri, 29 Jul 2005 16:24:33 -0300 (ADT) +Received: (qmail 1771 invoked from network); 29 Jul 2005 21:24:39 +0200 +Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) + by boutiquenumerique.com with SMTP; 29 Jul 2005 21:24:39 +0200 +To: "Matthew Schumacher" , + "Andrew McMillan" +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> + <42EA6966.8090402@aptalaska.net> +Message-ID: +Date: Fri, 29 Jul 2005 21:24:32 +0200 +From: PFC +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <42EA6966.8090402@aptalaska.net> +User-Agent: Opera M2/8.0 (Linux, build 1095) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/485 +X-Sequence-Number: 13726 + + + +> Also, this test goes a bit faster with sync turned off, if mysql isn't +> using sync that would be why it's so much faster. Anyone know what the +> default for mysql is? + + For InnoDB I think it's like Postgres (only slower) ; for MyISAM it's no +fsync, no transactions, no crash tolerance of any kind, and it's not a +default value (in the sense that you could tweak it) it's just the way +it's coded. + +From pgsql-performance-owner@postgresql.org Fri Jul 29 17:20:12 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DEA02529F3 + for ; + Fri, 29 Jul 2005 17:20:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34528-09 + for ; + Fri, 29 Jul 2005 20:20:05 +0000 (GMT) +Received: from mail1.catalyst.net.nz (godel.catalyst.net.nz [202.78.240.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 808D7529FA + for ; + Fri, 29 Jul 2005 17:20:03 -0300 (ADT) +Received: from 222-152-153-141.jetstream.xtra.co.nz ([222.152.153.141] + helo=lamb.mcmillan.net.nz) by mail1.catalyst.net.nz with esmtpsa + (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.50) + id 1DybKt-0004Kk-4e; Sat, 30 Jul 2005 08:20:03 +1200 +Received: from lamb.mcmillan.net.nz (lamb.mcmillan.net.nz [127.0.0.1]) + by lamb.mcmillan.net.nz (Postfix) with ESMTP id 0B4387A0056; + Sat, 30 Jul 2005 08:19:31 +1200 (NZST) +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +From: Andrew McMillan +To: Matthew Schumacher +Cc: pgsql-performance@postgresql.org +In-Reply-To: <42EA6966.8090402@aptalaska.net> +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> + <42EA6966.8090402@aptalaska.net> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-DNVOu4hRQ9hQ5n4gHR3j" +Date: Sat, 30 Jul 2005 08:19:31 +1200 +Message-Id: <1122668371.5691.352.camel@lamb.mcmillan.net.nz> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/486 +X-Sequence-Number: 13727 + + +--=-DNVOu4hRQ9hQ5n4gHR3j +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +On Fri, 2005-07-29 at 09:37 -0800, Matthew Schumacher wrote: +> >=20 +> > On my laptop this takes: +> >=20 +> > real 1m33.758s +> > user 0m4.285s +> > sys 0m1.181s +> >=20 +> > One interesting effect is the data in bayes_vars has a huge number of +> > updates and needs vacuum _frequently_. After the run a vacuum full +> > compacts it down from 461 pages to 1 page. +> >=20 +>=20 +> I wonder why your laptop is so much faster. My 2 min 30 sec test was +> done on a dual xeon with a LSI megaraid with 128MB cache and writeback +> caching turned on. + +I only do development stuff on my laptop, and all of my databases are +reconstructable from copies, etc... so I turn off fsync in this case. + + +> How often should this table be vacuumed, every 5 minutes? + +I would be tempted to vacuum after each e-mail, in this case. + + +> Also, this test goes a bit faster with sync turned off, if mysql isn't +> using sync that would be why it's so much faster. Anyone know what the +> default for mysql is? + +It depends on your table type for MySQL. + +For the data in question (i.e. bayes scoring) it would seem that not +much would be lost if you did have to restore your data from a day old +backup, so perhaps fsync=3Dfalse is OK for this particular application. + +Regards, + Andrew McMillan. + +------------------------------------------------------------------------- +Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington +WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St +DDI: +64(4)803-2201 MOB: +64(272)DEBIAN OFFICE: +64(4)499-2267 + What we wish, that we readily believe. + -- Demosthenes +------------------------------------------------------------------------- + + +--=-DNVOu4hRQ9hQ5n4gHR3j +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (GNU/Linux) + +iD8DBQBC6o9TjJA0f48GgBIRAvYxAJ0bPLVgHixIXfve5oiOg+k2aFv0+QCfTqh6 +4bza1zu2EkvnPnd0PAJFz+c= +=ICIU +-----END PGP SIGNATURE----- + +--=-DNVOu4hRQ9hQ5n4gHR3j-- + + +From pgsql-performance-owner@postgresql.org Fri Jul 29 17:31:02 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 887D1529C0 + for ; + Fri, 29 Jul 2005 17:30:59 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38606-04 + for ; + Fri, 29 Jul 2005 20:30:58 +0000 (GMT) +Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 05C9F52938 + for ; + Fri, 29 Jul 2005 17:30:57 -0300 (ADT) +Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net + [64.4.232.33]) (authenticated bits=0) + by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j6TKhsEn019125 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); + Fri, 29 Jul 2005 12:43:55 -0800 +Message-ID: <42EA91DC.9030306@aptalaska.net> +Date: Fri, 29 Jul 2005 12:30:20 -0800 +From: Matthew Schumacher +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Andrew McMillan +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> + <42EA6966.8090402@aptalaska.net> + <1122668371.5691.352.camel@lamb.mcmillan.net.nz> +In-Reply-To: <1122668371.5691.352.camel@lamb.mcmillan.net.nz> +X-Enigmail-Version: 0.91.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Spam-Bayes: Learn: ham +X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/487 +X-Sequence-Number: 13728 + +Andrew McMillan wrote: +> +> For the data in question (i.e. bayes scoring) it would seem that not +> much would be lost if you did have to restore your data from a day old +> backup, so perhaps fsync=false is OK for this particular application. +> +> Regards, +> Andrew McMillan. +> + +Restoring from the previous days backup is plenty exceptable in this +application, so is it possible to turn fsync off, but only for this +database, or would I need to start another psql instance? + +schu + +From pgsql-performance-owner@postgresql.org Fri Jul 29 18:02:15 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 941D652AE1 + for ; + Fri, 29 Jul 2005 18:02:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45261-01 + for ; + Fri, 29 Jul 2005 21:02:07 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 79788529C0 + for ; + Fri, 29 Jul 2005 18:02:05 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6TL1vHT019406; + Fri, 29 Jul 2005 17:01:58 -0400 (EDT) +To: Andrew McMillan +Cc: Matthew Schumacher , + pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +In-reply-to: <1122668371.5691.352.camel@lamb.mcmillan.net.nz> +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> + <42EA6966.8090402@aptalaska.net> + <1122668371.5691.352.camel@lamb.mcmillan.net.nz> +Comments: In-reply-to Andrew McMillan + message dated "Sat, 30 Jul 2005 08:19:31 +1200" +Date: Fri, 29 Jul 2005 17:01:57 -0400 +Message-ID: <19405.1122670917@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/488 +X-Sequence-Number: 13729 + +Andrew McMillan writes: +> On Fri, 2005-07-29 at 09:37 -0800, Matthew Schumacher wrote: +>> How often should this table be vacuumed, every 5 minutes? + +> I would be tempted to vacuum after each e-mail, in this case. + +Perhaps the bulk of the transient states should be done in a temp table, +and only write into a real table when you're done? Dropping a temp +table is way quicker than vacuuming it ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jul 29 18:48:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6836F52A1B + for ; + Fri, 29 Jul 2005 18:48:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51084-09 + for ; + Fri, 29 Jul 2005 21:48:01 +0000 (GMT) +Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 3DEC752831 + for ; + Fri, 29 Jul 2005 18:48:00 -0300 (ADT) +Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net + [64.4.232.33]) (authenticated bits=0) + by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j6TM1ZEQ003150 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) + for ; Fri, 29 Jul 2005 14:01:35 -0800 +Message-ID: <42EAA410.9010700@aptalaska.net> +Date: Fri, 29 Jul 2005 13:48:00 -0800 +From: Matthew Schumacher +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> + <42EA6966.8090402@aptalaska.net> + <1122668371.5691.352.camel@lamb.mcmillan.net.nz> + <19405.1122670917@sss.pgh.pa.us> +In-Reply-To: <19405.1122670917@sss.pgh.pa.us> +X-Enigmail-Version: 0.91.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Spam-Bayes: Learn: unavailable +X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200507/489 +X-Sequence-Number: 13730 + + +Ok, here is where I'm at, I reduced the proc down to this: + +CREATE FUNCTION update_token (_id INTEGER, + _token BYTEA, + _spam_count INTEGER, + _ham_count INTEGER, + _atime INTEGER) +RETURNS VOID AS +$$ +BEGIN + LOOP + UPDATE bayes_token + SET spam_count = spam_count + _spam_count, + ham_count = ham_count + _ham_count, + atime = _atime + WHERE id = _id + AND token = _token; + + IF found THEN + RETURN; + END IF; + + INSERT INTO bayes_token VALUES (_id, _token, _spam_count, +_ham_count, _atime); + IF FOUND THEN + UPDATE bayes_vars SET token_count = token_count + 1 WHERE id = _id; + IF NOT FOUND THEN + RAISE EXCEPTION 'unable to update token_count in bayes_vars'; + return FALSE; + END IF; + + RETURN; + END IF; + + RETURN; + END LOOP; +END; +$$ +LANGUAGE plpgsql; + +All it's doing is trying the update before the insert to get around the +problem of not knowing which is needed. With only 2-3 of the queries +implemented I'm already back to running about the same speed as the +original SA proc that is going to ship with SA 3.1.0. + +All of the queries are using indexes so at this point I'm pretty +convinced that the biggest problem is the sheer number of queries +required to run this proc 200 times for each email (once for each token). + +I don't see anything that could be done to make this much faster on the +postgres end, it's looking like the solution is going to involve cutting +down the number of queries some how. + +One thing that is still very puzzling to me is why this runs so much +slower when I put the data.sql in a transaction. Obviously transactions +are acting different when you call a proc a zillion times vs an insert +query. + +Anyway, if anyone else has any ideas I'm all ears, but at this point +it's looking like raw query speed is needed for this app and while I +don't care for mysql as a database, it does have the speed going for it. + +schu + +From pgsql-performance-owner@postgresql.org Fri Jul 29 20:19:08 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A7AF52A23 + for ; + Fri, 29 Jul 2005 20:19:07 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67627-08 + for ; + Fri, 29 Jul 2005 23:18:57 +0000 (GMT) +Received: from netbox.unitech.com.ar (unknown [200.32.92.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 8CDFD529FA + for ; + Fri, 29 Jul 2005 20:18:54 -0300 (ADT) +Received: from dariop (dariop.unitech.com.ar [192.168.1.237]) + by netbox.unitech.com.ar (8.11.6/8.11.6) with ESMTP id j6U0IBE25796; + Fri, 29 Jul 2005 20:18:12 -0400 +Received: from 127.0.0.1 (AVG SMTP 7.0.338 [267.9.7]); + Fri, 29 Jul 2005 20:18:56 -0300 +From: "Dario" +To: "Chris Travers" +Cc: +Subject: Re: Left joining against two empty tables makes a query +Date: Fri, 29 Jul 2005 20:18:56 -0300 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) +In-Reply-To: <42E9BD43.6060203@travelamericas.com> +X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.071 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/490 +X-Sequence-Number: 13731 + +Sorry for my english. +May I ask? (i'm still learning postgresql). Isn't outer join forcing "join +order"? +The planner will resolve a, then ac in order to resolve left join previously +and will not be able to choose the customer_id filter (more selective)... +AFAIK (not too far :-)) this will be the join order, even if projects and +deparments are not empty, no matter how much statistical info you (the +engine) have (has). + +Workaround: +You should probably try to use a subquery to allow planner to choose join +order (as long as you can modify source code :-O ). You know project and +department are empty now so... + + +SELECT aa.accno, aa.description, aa.link, aa.category, aa.project_id, +aa.department, p.projectnumber, d.description from ( + SELECT c.accno, c.description, c.link, c.category, ac.project_id, + a.department_id AS department + FROM chart c JOIN acc_trans ac ON (ac.chart_id = c.id) + JOIN ar a ON (a.id = ac.trans_id) + WHERE a.customer_id = 11373 AND a.id IN ( + SELECT max(id) FROM ar WHERE customer_id = 11373) + ) aa + + LEFT JOIN project p ON (aa.project_id = p.id) + LEFT JOIN department d ON (d.id = aa.department) + +Doubt of it. I rewrite it at first sight. + +Long life, little spam and prosperity. + +-----Mensaje original----- +De: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org]En nombre de Chris +Travers +Enviado el: viernes, 29 de julio de 2005 2:23 +Para: Gnanavel S +CC: Chris Travers; pgsql-performance@postgresql.org +Asunto: Re: [PERFORM] Left joining against two empty tables makes a +query + + + +> +> Secondly, the project table has *never* had anything in it. So where +> are these numbers coming from? +> +> +> pg_statistics + +I very much doubt that. I was unable to locate any rows in pg_statistic +where the pg_class.oid for either table matched any row's starelid. + +Tom's argument that this is behavior by design makes sense. I assumed +that something like that had to be going on, otherwise there would be +nowhere for the numbers to come from. I.e. if there never were any rows +in the table, then if pg_statistic is showing 1060 rows, we have bigger +problems than a bad query plan. I hope however that eventually tables +which are truly empty can be treated intelligently sometime in the +future in Left Joins. Otherwise this limits the usefulness of out of +the box solutions which may have functionality that we don't use. Such +solutions can then kill the database performance quite easily. + +Chris Travers +Metatron Technology Consulting + +---------------------------(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 Jul 29 21:41:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9FBF052A8C + for ; + Fri, 29 Jul 2005 21:41:49 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84202-10 + for ; + Sat, 30 Jul 2005 00:41:48 +0000 (GMT) +Received: from veggie-fuel.com (veggie-fuel.com [200.46.208.238]) + by svr1.postgresql.org (Postfix) with ESMTP id 4974252A89 + for ; + Fri, 29 Jul 2005 21:41:47 -0300 (ADT) +Received: from localhost (unknown [200.46.204.144]) + by veggie-fuel.com (Postfix) with ESMTP id 150E135F9DE + for ; + Sat, 30 Jul 2005 00:41:51 +0000 (GMT) +Received: from veggie-fuel.com ([200.46.208.238]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 90067-01; Sat, 30 Jul 2005 00:41:34 +0000 (GMT) +Received: from [10.0.0.7] (63-228-143-68.phnx.qwest.net [63.228.143.68]) + by veggie-fuel.com (Postfix) with ESMTP id 20B9735F9D6; + Sat, 30 Jul 2005 00:41:35 +0000 (GMT) +Subject: Re: Performance problems testing with Spamassassin +From: Karim Nassar +Reply-To: karim.nassar@acm.org +To: Josh Berkus +Cc: Matthew Schumacher , + Andrew McMillan , + Luke Lonergan , pgsql-performance@postgresql.org +In-Reply-To: <200507290947.03700.josh@agliodbs.com> +References: <3E37B936B592014B978C4415F90D662D0C4221@MI8NYCMAIL06.Mi8.com> + <200507290947.03700.josh@agliodbs.com> +Content-Type: text/plain +Date: Fri, 29 Jul 2005 17:39:41 -0700 +Message-Id: <1122683983.11869.150.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.027 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/491 +X-Sequence-Number: 13732 + +On Fri, 2005-07-29 at 09:47 -0700, Josh Berkus wrote: +> Try changing: +> wal_buffers = 256 +> +> and try Bruce's stop full_page_writes patch. +> +> > I guess we see the real culprit here. Anyone surprised it's the WAL? +> +> Nope. On high-end OLTP stuff, it's crucial that the WAL have its own +> dedicated disk resource. +> +> Also, running a complex stored procedure for each and every word in each +> e-mail is rather deadly ... with the e-mail traffic our server at Globix +> receives, for example, that would amount to running it about 1,000 times a +> minute. + +Is this a real-world fix? Seems to me that Spam Assassin runs on a +plethora of mail servers, and optimizing his/her/my/your pg config +doesn't solve the root problem: there are thousands of (seemingly) +high-overhead function calls being executed. + + +> It would be far better to batch this, somehow, maybe using temp +> tables. + +Agreed. On my G4 laptop running the default configured Ubuntu Linux +postgresql 7.4.7 package, it took 43 minutes for Matthew's script to run +(I ran it twice just to be sure). In my spare time over the last day, I +created a brute force perl script that took under 6 minutes. Am I on to +something, or did I just optimize for *my* system? + +http://ccl.cens.nau.edu/~kan4/files/k-bayesBenchmark.tar.gz + +kan4@slap-happy:~/k-bayesBenchmark$ time ./test.pl +<-- snip db creation stuff --> +17:18:44 -- START +17:19:37 -- AFTER TEMP LOAD : loaded 120596 records +17:19:46 -- AFTER bayes_token INSERT : inserted 49359 new records into bayes_token +17:19:50 -- AFTER bayes_vars UPDATE : updated 1 records +17:23:37 -- AFTER bayes_token UPDATE : updated 47537 records +DONE + +real 5m4.551s +user 0m29.442s +sys 0m3.925s + + +I am sure someone smarter could optimize further. + +Anyone with a super-spifty machine wanna see if there is an improvement +here? + +-- +Karim Nassar + + +From pgsql-performance-owner@postgresql.org Sat Jul 30 04:57:55 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8C4B052BAA + for ; + Sat, 30 Jul 2005 04:57:53 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 85800-03 + for ; + Sat, 30 Jul 2005 07:57:44 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 3F92E528C7 + for ; + Sat, 30 Jul 2005 04:57:43 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 39AF230B42; Sat, 30 Jul 2005 10:05:38 +0200 (MET DST) +From: William Yu +X-Newsgroups: pgsql.performance +Subject: Re: Performance problems on 4/8way Opteron (dualcore) +Date: Sat, 30 Jul 2005 00:57:38 -0700 +Organization: Hub.Org Networking Services +Lines: 20 +Message-ID: +References: <200507291046.10318.josh@agliodbs.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +In-Reply-To: +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.018 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/492 +X-Sequence-Number: 13733 + +I've been running 2x265's on FC4 64-bit (2.6.11-1+) and it's been +running perfect. With NUMA enabled, it runs incrementally faster than +NUMA off. Performance is definitely better than the 2x244s they replaced +-- how much faster, I can't measure since I don't have the transaction +volume to compare to previous benchmarks. I do see more consistently low +response times though, can run apache also on the server for faster HTML +generation times and top seems to show in general twice as much CPU +power idle on average (25% per 265 core versus 50% per 244.) + +I haven't investigated the 2.6.12+ kernel updates yet -- I probably will +do our development servers first to give it a test. + + +> The problem as I remember it boiled down to the Linux kernel handling +> memory/process management very badly on large dual core systems -- +> pathological NUMA behavior. However, this problem has apparently been fixed +> in Linux v2.6.12+, and using the more recent kernel on large dual core +> systems generated *massive* performance improvements on these systems for +> the individuals with this issue. Using the patched kernel, one gets the +> performance most people were expecting. + +From pgsql-performance-owner@postgresql.org Sat Jul 30 05:46:44 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 78CA952C16 + for ; + Sat, 30 Jul 2005 05:46:43 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94638-05 + for ; + Sat, 30 Jul 2005 08:46:32 +0000 (GMT) +Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 48C4652BF8 + for ; + Sat, 30 Jul 2005 05:46:31 -0300 (ADT) +Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net + [64.4.232.33]) (authenticated bits=0) + by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j6U908jK000928 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); + Sat, 30 Jul 2005 01:00:09 -0800 +Message-ID: <42EB3E63.6040300@aptalaska.net> +Date: Sat, 30 Jul 2005 00:46:27 -0800 +From: Matthew Schumacher +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: karim.nassar@acm.org +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin +References: <3E37B936B592014B978C4415F90D662D0C4221@MI8NYCMAIL06.Mi8.com> + <200507290947.03700.josh@agliodbs.com> + <1122683983.11869.150.camel@localhost.localdomain> +In-Reply-To: <1122683983.11869.150.camel@localhost.localdomain> +X-Enigmail-Version: 0.91.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Spam-Bayes: Learn: ham +X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/493 +X-Sequence-Number: 13734 + +Karim Nassar wrote: +> +> kan4@slap-happy:~/k-bayesBenchmark$ time ./test.pl +> <-- snip db creation stuff --> +> 17:18:44 -- START +> 17:19:37 -- AFTER TEMP LOAD : loaded 120596 records +> 17:19:46 -- AFTER bayes_token INSERT : inserted 49359 new records into bayes_token +> 17:19:50 -- AFTER bayes_vars UPDATE : updated 1 records +> 17:23:37 -- AFTER bayes_token UPDATE : updated 47537 records +> DONE +> +> real 5m4.551s +> user 0m29.442s +> sys 0m3.925s +> +> +> I am sure someone smarter could optimize further. +> +> Anyone with a super-spifty machine wanna see if there is an improvement +> here? +> + +There is a great improvement in loading the data. While I didn't load +it on my server, my test box shows significant gains. + +It seems that the only thing your script does different is separate the +updates from inserts so that an expensive update isn't called when we +want to insert. The other major difference is the 'IN' and 'MOT IN' +syntax which looks to be much faster than trying everything as an update +before inserting. + +While these optimizations seem to make a huge difference in loading the +token data, the real life scenario is a little different. + +You see, the database keeps track of the number of times each token was +found in ham or spam, so that when we see a new message we can parse it +into tokens then compare with the database to see how likely the +messages is spam based on the statistics of tokens we have already +learned on. + +Since we would want to commit this data after each message, the number +of tokens processed at one time would probably only be a few hundred, +most of which are probably updates after we have trained on a few +thousand emails. + +I apologize if my crude benchmark was misleading, it was meant to +simulate the sheer number of inserts/updates the database may go though +in an environment that didn't require people to load spamassassin and +start training on spam. + +I'll do some more testing on Monday, perhaps grouping even 200 tokens at +a time using your method will yield significant gains, but probably not +as dramatic as it does using my loading benchmark. + +I post more when I have a chance to look at this in more depth. + +Thanks, +schu + +From pgsql-performance-owner@postgresql.org Sat Jul 30 07:36:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 55E0052965 + for ; + Sat, 30 Jul 2005 07:36:12 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 15216-07 + for ; + Sat, 30 Jul 2005 10:36:10 +0000 (GMT) +Received: from veggie-fuel.com (veggie-fuel.com [200.46.208.238]) + by svr1.postgresql.org (Postfix) with ESMTP id E8B3A52AC6 + for ; + Sat, 30 Jul 2005 07:36:09 -0300 (ADT) +Received: from localhost (unknown [200.46.204.144]) + by veggie-fuel.com (Postfix) with ESMTP id A1DFB35F9E5 + for ; + Sat, 30 Jul 2005 10:36:11 +0000 (GMT) +Received: from veggie-fuel.com ([200.46.208.238]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17010-07; Sat, 30 Jul 2005 10:35:58 +0000 (GMT) +Received: from [10.0.0.7] (63-228-143-68.phnx.qwest.net [63.228.143.68]) + by veggie-fuel.com (Postfix) with ESMTP id 1E6BB35F9DE; + Sat, 30 Jul 2005 10:35:59 +0000 (GMT) +Subject: Re: Performance problems testing with Spamassassin +From: Karim Nassar +Reply-To: karim.nassar@acm.org +To: Matthew Schumacher +Cc: pgsql-performance@postgresql.org +In-Reply-To: <42EB3E63.6040300@aptalaska.net> +References: <3E37B936B592014B978C4415F90D662D0C4221@MI8NYCMAIL06.Mi8.com> + <200507290947.03700.josh@agliodbs.com> + <1122683983.11869.150.camel@localhost.localdomain> + <42EB3E63.6040300@aptalaska.net> +Content-Type: text/plain +Date: Sat, 30 Jul 2005 03:34:00 -0700 +Message-Id: <1122719640.7426.173.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.2.1.1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.026 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/494 +X-Sequence-Number: 13735 + +On Sat, 2005-07-30 at 00:46 -0800, Matthew Schumacher wrote: + +> I'll do some more testing on Monday, perhaps grouping even 200 tokens at +> a time using your method will yield significant gains, but probably not +> as dramatic as it does using my loading benchmark. + +In that case, some of the clauses could be simplified further since we +know that we are dealing with only one user. I don't know what that will +get us, since postgres is so damn clever. + +I suspect that the aggregate functions will be more efficient when you +do this, since the temp table will be much smaller, but I am only +guessing at this point. + +If you need to support a massive initial data load, further time savings +are to be had by doing COPY instead of 126,000 inserts. + +Please do keep us updated. + +Thanking all the gods and/or developers for spamassassin, +-- +Karim Nassar + + +From pgsql-performance-owner@postgresql.org Sat Jul 30 15:29:17 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D9463529DD + for ; + Sat, 30 Jul 2005 15:29:13 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20485-01 + for ; + Sat, 30 Jul 2005 18:29:02 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id CC5AD52AA5 + for ; + Sat, 30 Jul 2005 15:28:59 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6UISrlI027898; + Sat, 30 Jul 2005 14:28:53 -0400 (EDT) +To: Matthew Schumacher +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +In-reply-to: <42EAA410.9010700@aptalaska.net> +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> + <42EA6966.8090402@aptalaska.net> + <1122668371.5691.352.camel@lamb.mcmillan.net.nz> + <19405.1122670917@sss.pgh.pa.us> <42EAA410.9010700@aptalaska.net> +Comments: In-reply-to Matthew Schumacher + message dated "Fri, 29 Jul 2005 13:48:00 -0800" +Date: Sat, 30 Jul 2005 14:28:53 -0400 +Message-ID: <27897.1122748133@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/495 +X-Sequence-Number: 13736 + +Matthew Schumacher writes: +> One thing that is still very puzzling to me is why this runs so much +> slower when I put the data.sql in a transaction. Obviously transactions +> are acting different when you call a proc a zillion times vs an insert +> query. + +I looked into this a bit. It seems that the problem when you wrap the +entire insertion series into one transaction is associated with the fact +that the test does so many successive updates of the single row in +bayes_vars. (VACUUM VERBOSE at the end of the test shows it cleaning up +49383 dead versions of the one row.) This is bad enough when it's in +separate transactions, but when it's in one transaction, none of those +dead row versions can be marked "fully dead" yet --- so for every update +of the row, the unique-key check has to visit every dead version to make +sure it's dead in the context of the current transaction. This makes +the process O(N^2) in the number of updates per transaction. Which is +bad enough if you just want to do one transaction per message, but it's +intolerable if you try to wrap the whole bulk-load scenario into one +transaction. + +I'm not sure that we can do anything to make this a lot smarter, but +in any case, the real problem is to not do quite so many updates of +bayes_vars. + +How constrained are you as to the format of the SQL generated by +SpamAssassin? In particular, could you convert the commands generated +for a single message into a single statement? I experimented with +passing all the tokens for a given message as a single bytea array, +as in the attached, and got almost a factor of 4 runtime reduction +on your test case. + +BTW, it's possible that this is all just a startup-transient problem: +once the database has been reasonably well populated, one would expect +new tokens to be added infrequently, and so the number of updates to +bayes_vars ought to drop off. + + regards, tom lane + + +Revised insertion procedure: + + +CREATE or replace FUNCTION put_tokens (_id INTEGER, + _tokens BYTEA[], + _spam_count INTEGER, + _ham_count INTEGER, + _atime INTEGER) +RETURNS VOID AS +$$ +declare _token bytea; + new_tokens integer := 0; +BEGIN + for i in array_lower(_tokens,1) .. array_upper(_tokens,1) + LOOP + _token := _tokens[i]; + UPDATE bayes_token + SET spam_count = spam_count + _spam_count, + ham_count = ham_count + _ham_count, + atime = _atime + WHERE id = _id + AND token = _token; + + IF not found THEN + INSERT INTO bayes_token VALUES (_id, _token, _spam_count, + _ham_count, _atime); + new_tokens := new_tokens + 1; + END IF; + END LOOP; + if new_tokens > 0 THEN + UPDATE bayes_vars SET token_count = token_count + new_tokens + WHERE id = _id; + IF NOT FOUND THEN + RAISE EXCEPTION 'unable to update token_count in bayes_vars'; + END IF; + END IF; + RETURN; +END; +$$ +LANGUAGE plpgsql; + + +Typical input: + + +select put_tokens(1,'{"\\125\\42\\80\\167\\166","\\38\\153\\220\\93\\190","\\68\\7\\112\\52\\224","\\51\\14\\78\\155\\49","\\73\\245\\15\\221\\43","\\96\\179\\108\\197\\121","\\123\\97\\220\\173\\247","\\55\\132\\243\\51\\65","\\238\\36\\129\\75\\181","\\145\\253\\196\\106\\90","\\119\\0\\51\\127\\236","\\229\\35\\181\\222\\3","\\163\\1\\191\\220\\79","\\232\\97\\152\\207\\26","\\111\\146\\81\\182\\250","\\47\\141\\12\\76\\45","\\252\\97\\168\\243\\222","\\24\\157\\202\\45\\24","\\230\\207\\30\\46\\115","\\106\\45\\182\\94\\136","\\45\\66\\245\\41\\103","\\108\\126\\171\\154\\210","\\64\\90\\1\\184\\145","\\242\\78\\150\\104\\213","\\214\\\\134\\7\\179\\150","\\249\\12\\247\\164\\74","\\234\\35\\93\\118\\102","\\5\\152\\152\\219\\188","\\99\\186\\172\\56\\241","\\99\\220\\62\\240\\148","\\106\\12\\199\\33\\177","\\34\\74\\190\\192\\186","\\219\\127\\145\\132\\203","\\240\\113\\128\\160\\46","\\83\\5\\239\\206\\221","\\245\\253\\219\\83\\250","\\1\\53\\126\\56\\129","\\206\\1! + 30\\97\\246\\47","\\217\\57\\185\\37\\202","\\235\\10\\74\\224\\150","\\80\\151\\70\\52\\96","\\126\\49\\156\\162\\93","\\243\\120\\218\\226\\49","\\251\\132\\118\\47\\221","\\241\\160\\120\\146\\198","\\183\\32\\161\\223\\178","\\80\\205\\77\\57\\2","\\121\\231\\13\\71\\218","\\71\\143\\184\\88\\185","\\163\\96\\119\\211\\142","\\20\\143\\90\\91\\211","\\179\\228\\212\\15\\22","\\243\\35\\149\\9\\55","\\140\\149\\99\\233\\241","\\164\\246\\101\\147\\107","\\202\\70\\218\\40\\114","\\39\\36\\186\\46\\84","\\58\\116\\44\\237\\2","\\80\\204\\185\\47\\105","\\64\\227\\29\\108\\222","\\173\\115\\56\\91\\52","\\102\\39\\157\\252\\64","\\133\\9\\89\\207\\62","\\27\\2\\230\\227\\201","\\163\\45\\123\\160\\129","\\170\\131\\168\\107\\198","\\236\\253\\0\\43\\228","\\44\\255\\93\\197\\136","\\64\\122\\42\\230\\126","\\207\\222\\104\\27\\239","\\26\\240\\78\\73\\45","\\225\\107\\181\\246\\160","\\231\\72\\243\\36\\159","\\248\\60\\14\\67\\145","\\21\\161\\247\\43\\198","\\81\\243\\19! + 1\\168\\18","\\237\\227\\23\\40\\140","\\60\\90\\96\\168\\201","\\211\ +\107\\181\\46\\38","\\178\\129\\212\\16\\254","\\85\\177\\246\\29\\221","\\182\\123\\178\\157\\9","\\154\\159\\180\\116\\89","\\80\\136\\196\\242\\161","\\185\\110\\90\\163\\157","\\163\\191\\229\\13\\42","\\11\\119\\205\\160\\223","\\75\\216\\70\\223\\6","\\130\\48\\154\\145\\51","\\62\\104\\212\\72\\3","\\247\\105\\51\\64\\136","\\17\\96\\45\\40\\77","\\52\\1\\252\\53\\121","\\68\\195\\58\\103\\91","\\135\\131\\100\\4\\0","\\131\\129\\44\\193\\194","\\47\\234\\101\\143\\26","\\206\\\\134\\32\\154\\0","\\17\\41\\177\\34\\178","\\145\\127\\114\\231\\216","\\19\\172\\6\\39\\126","\\237\\233\\121\\43\\119","\\201\\167\\167\\67\\233","\\88\\159\\102\\50\\117","\\100\\133\\107\\190\\133","\\169\\146\\178\\120\\106"}',1,0,1088628232); +select put_tokens(1,'{"\\196\\75\\30\\153\\73","\\73\\245\\15\\221\\43","\\14\\7\\116\\254\\162","\\244\\161\\139\\59\\16","\\214\\226\\238\\196\\30","\\209\\14\\131\\231\\30","\\41\\\\134\\176\\195\\166","\\70\\206\\48\\38\\33","\\247\\131\\136\\80\\31","\\4\\85\\5\\167\\214","\\246\\106\\225\\106\\242","\\28\\0\\229\\160\\90","\\127\\209\\58\\120\\83","\\12\\52\\52\\147\\95","\\255\\115\\21\\5\\68","\\244\\152\\121\\76\\20","\\19\\128\\183\\248\\181","\\140\\91\\18\\127\\208","\\93\\9\\62\\196\\247","\\248\\200\\31\\207\\108","\\44\\216\\247\\15\\195","\\59\\189\\9\\237\\142","\\1\\14\\10\\221\\68","\\163\\155\\122\\223\\104","\\97\\5\\105\\55\\137","\\184\\211\\162\\23\\247","\\239\\249\\83\\68\\54","\\67\\207\\180\\186\\234","\\99\\78\\237\\211\\180","\\200\\11\\32\\179\\50","\\95\\105\\18\\60\\253","\\207\\102\\227\\94\\84","\\71\\143\\184\\88\\185","\\13\\181\\75\\24\\192","\\188\\241\\141\\99\\242","\\139\\124\\248\\130\\4","\\25\\110\\149\\63\\114","\\21\\162\\199\\1! + 29\\199","\\164\\246\\101\\147\\107","\\198\\202\\223\\58\\197","\\181\\10\\41\\25\\130","\\71\\163\\116\\239\\170","\\46\\170\\238\\142\\89","\\176\\120\\106\\103\\228","\\39\\228\\25\\38\\170","\\114\\79\\121\\18\\222","\\178\\105\\98\\61\\39","\\90\\61\\12\\23\\135","\\176\\118\\81\\65\\66","\\55\\104\\57\\198\\150","\\206\\251\\224\\128\\41","\\29\\158\\68\\146\\164","\\248\\60\\14\\67\\145","\\210\\220\\161\\10\\254","\\72\\81\\151\\213\\68","\\25\\236\\210\\197\\128","\\72\\37\\208\\227\\54","\\242\\24\\6\\88\\26","\\128\\197\\20\\5\\211","\\98\\105\\71\\42\\180","\\91\\43\\72\\84\\104","\\205\\254\\174\\65\\141","\\222\\194\\126\\204\\164","\\233\\153\\37\\148\\226","\\32\\195\\22\\153\\87","\\194\\97\\220\\251\\18","\\151\\201\\148\\52\\147","\\205\\55\\0\\226\\58","\\172\\12\\50\\0\\140","\\56\\32\\43\\9\\45","\\18\\174\\50\\162\\126","\\138\\150\\12\\72\\189","\\49\\230\\150\\210\\48","\\2\\140\\64\\104\\32","\\14\\174\\41\\196\\121","\\100\\195\\116\\130\\101","\! + \222\\45\\94\\39\\64","\\178\\203\\221\\63\\94","\\26\\188\\157\\\\134 +\\52","\\119\\0\\51\\127\\236","\\88\\32\\224\\142\\164","\\111\\146\\81\\182\\250","\\12\\177\\151\\83\\13","\\113\\27\\173\\162\\19","\\158\\216\\41\\236\\226","\\16\\88\\\\134\\180\\112","\\43\\32\\16\\77\\238","\\136\\93\\210\\172\\63","\\251\\214\\30\\40\\146","\\156\\27\\198\\60\\170","\\185\\29\\172\\30\\68","\\202\\83\\59\\228\\252","\\219\\127\\145\\132\\203","\\1\\223\\97\\229\\127","\\113\\83\\123\\167\\140","\\99\\1\\116\\56\\165","\\143\\224\\239\\1\\173","\\49\\186\\156\\51\\92","\\246\\224\\70\\245\\137","\\235\\10\\74\\224\\150","\\43\\88\\245\\14\\103","\\88\\128\\232\\142\\254","\\251\\132\\118\\47\\221","\\36\\7\\142\\234\\98","\\130\\126\\199\\170\\126","\\133\\23\\51\\253\\234","\\249\\89\\242\\87\\86","\\102\\243\\47\\193\\211","\\140\\18\\140\\164\\248","\\179\\228\\212\\15\\22","\\168\\155\\243\\169\\191","\\117\\37\\139\\241\\230","\\155\\11\\254\\171\\200","\\196\\159\\253\\223\\15","\\93\\207\\154\\106\\135","\\11\\255\\28\\123\\125","\\239\\9\\226! + \\59\\198","\\191\\204\\230\\61\\39","\\175\\204\\181\\113\\\\134","\\64\\227\\29\\108\\222","\\169\\173\\194\\83\\40","\\212\\93\\170\\169\\12","\\249\\55\\232\\182\\208","\\75\\175\\181\\248\\246","\\108\\95\\114\\215\\138","\\220\\37\\59\\207\\197","\\45\\146\\43\\76\\81","\\166\\231\\20\\9\\189","\\27\\126\\81\\92\\75","\\66\\168\\119\\100\\196","\\229\\9\\196\\165\\250","\\83\\186\\103\\184\\46","\\85\\177\\246\\29\\221","\\140\\159\\53\\211\\157","\\214\\193\\192\\217\\109","\\10\\5\\64\\97\\157","\\92\\137\\120\\70\\55","\\235\\45\\181\\44\\98","\\150\\56\\132\\207\\19","\\67\\95\\161\\39\\122","\\109\\65\\145\\170\\79","\\\\134\\28\\90\\39\\33","\\226\\177\\240\\202\\157","\\1\\57\\50\\6\\240","\\249\\240\\222\\56\\161","\\110\\136\\88\\85\\249","\\82\\27\\239\\51\\211","\\114\\223\\252\\83\\189","\\129\\216\\251\\218\\80","\\247\\36\\101\\90\\229","\\209\\73\\221\\46\\11","\\242\\12\\120\\117\\\\134","\\146\\198\\57\\177\\49","\\212\\57\\9\\240\\216","\\215\\151\\2! + 16\\59\\75","\\47\\132\\161\\165\\54","\\113\\4\\77\\241\\150","\\217\ +\184\\149\\53\\124","\\152\\111\\25\\231\\104","\\42\\185\\112\\250\\156","\\39\\131\\14\\140\\189","\\148\\169\\158\\251\\150","\\184\\142\\204\\122\\179","\\19\\189\\181\\105\\116","\\116\\77\\22\\135\\50","\\236\\231\\60\\132\\229","\\200\\63\\76\\232\\9","\\32\\20\\168\\87\\45","\\99\\129\\99\\165\\29","\\2\\208\\66\\228\\105","\\99\\194\\194\\229\\17","\\85\\250\\55\\51\\114","\\200\\165\\249\\77\\72","\\5\\91\\178\\157\\24","\\245\\253\\219\\83\\250","\\166\\103\\181\\196\\34","\\227\\149\\148\\105\\157","\\95\\44\\15\\251\\98","\\183\\32\\161\\223\\178","\\120\\236\\145\\158\\78","\\244\\4\\92\\233\\112","\\189\\231\\124\\92\\19","\\112\\132\\8\\49\\157","\\160\\243\\244\\94\\104","\\150\\176\\139\\251\\157","\\176\\193\\155\\175\\144","\\161\\208\\145\\92\\92","\\77\\122\\94\\69\\182","\\77\\13\\131\\29\\27","\\92\\9\\178\\204\\254","\\177\\4\\154\\211\\63","\\62\\4\\242\\1\\78","\\4\\129\\113\\205\\164","\\168\\95\\68\\89\\38","\\173\\115\\56\\91\\52","\\212\\161\\1! + 59\\148\\179","\\133\\9\\89\\207\\62","\\242\\51\\168\\130\\86","\\154\\199\\208\\84\\2","\\160\\215\\250\\104\\22","\\45\\252\\143\\149\\204","\\48\\50\\91\\39\\243","\\94\\168\\48\\202\\122","\\238\\38\\180\\135\\142","\\234\\59\\24\\148\\2","\\237\\227\\23\\40\\140","\\7\\114\\176\\80\\123","\\204\\170\\0\\60\\65","\\217\\202\\249\\158\\182","\\82\\170\\45\\96\\86","\\118\\11\\123\\51\\216","\\192\\130\\153\\88\\59","\\219\\53\\146\\88\\198","\\203\\114\\182\\147\\145","\\158\\140\\239\\104\\247","\\179\\86\\111\\146\\65","\\192\\168\\51\\125\\183","\\8\\251\\77\\143\\231","\\237\\229\\173\\221\\29","\\69\\178\\247\\196\\175","\\114\\33\\237\\189\\119","\\220\\44\\144\\93\\98","\\241\\38\\138\\127\\252","\\66\\218\\237\\199\\157","\\132\\240\\212\\221\\48","\\180\\41\\157\\84\\37","\\203\\180\\58\\113\\136","\\156\\39\\111\\181\\34","\\16\\202\\216\\183\\55","\\154\\51\\122\\201\\45","\\218\\112\\47\\206\\142","\\189\\141\\110\\230\\132","\\80\\167\\61\\103\\247","\\186\! + \15\\121\\27\\167","\\103\\163\\217\\19\\220","\\173\\116\\86\\7\\249" +,"\\25\\37\\98\\35\\127","\\44\\92\\200\\89\\84","\\171\\129\\106\\249\\38","\\24\\147\\77\\\\134\\62","\\254\\184\\72\\159\\91","\\221\\13\\18\\153\\154","\\109\\232\\79\\169\\176","\\152\\103\\190\\50\\18","\\51\\71\\217\\22\\76","\\105\\109\\7\\77\\198","\\250\\121\\163\\49\\73","\\138\\204\\\\134\\247\\116","\\130\\38\\156\\36\\27","\\20\\83\\86\\113\\124","\\40\\63\\161\\157\\76","\\205\\99\\150\\109\\249","\\111\\174\\57\\169\\238","\\106\\169\\245\\170\\240","\\32\\10\\53\\160\\76","\\226\\0\\58\\9\\22","\\63\\83\\21\\3\\205","\\212\\141\\249\\177\\102","\\197\\226\\42\\202\\130","\\70\\40\\85\\176\\2","\\3\\16\\133\\118\\91","\\232\\48\\176\\209\\77","\\20\\149\\0\\2\\144","\\50\\87\\138\\108\\149","\\13\\78\\64\\211\\245","\\15\\158\\123\\62\\103","\\239\\68\\210\\175\\197","\\247\\216\\7\\211\\5","\\112\\100\\135\\210\\101","\\47\\26\\118\\254\\62","\\123\\7\\143\\206\\114","\\184\\43\\252\\56\\194","\\55\\16\\219\\\\134\\201","\\170\\128\\224\\160\\251","\\180\\10! + 8\\182\\255\\118","\\164\\155\\151\\195\\67","\\116\\56\\163\\249\\92","\\250\\207\\75\\244\\104","\\122\\219\\25\\49\\17","\\16\\61\\66\\50\\32","\\15\\223\\166\\\\134\\188","\\16\\221\\48\\159\\124","\\163\\66\\245\\19\\190","\\52\\177\\137\\57\\104","\\137\\158\\143\\12\\73","\\175\\156\\252\\243\\165","\\18\\119\\\\134\\198\\209","\\179\\60\\37\\63\\136","\\68\\117\\75\\163\\27","\\234\\108\\150\\93\\15","\\209\\159\\154\\221\\138","\\70\\215\\50\\36\\255","\\237\\64\\91\\125\\54","\\17\\41\\177\\34\\178","\\19\\241\\29\\12\\34","\\\\134\\151\\112\\6\\214","\\63\\61\\146\\243\\60"}',1,0,1088649636); + + +For testing purposes, here is the Perl script I used to make the revised +input from the original test script: + + +#!/usr/bin/perl -w + +$lastat = 0; + +while (<>) { + if (m/^select put_token\((\d+),'(.*)',(\d+),(\d+),(\d+)\);$/) { + $d1 = $1; + $data = $2; + $d3 = $3; + $d4 = $4; + $d5 = $5; + $data =~ s/\\/\\\\/g; + if ($d5 == $lastat) { + $last2 = $last2 . ',"' . $data . '"'; + } else { + if ($lastat) { + print "select put_tokens($last1,'{$last2}',$last3,$last4,$lastat);\n"; + } + $last1 = $d1; + $last2 = '"' . $data . '"'; + $last3 = $d3; + $last4 = $d4; + $lastat = $d5; + } + } else { + print ; + } +} + +print "select put_tokens($last1,'{$last2}',$last3,$last4,$lastat);\n"; + + +BTW, the data quoting is probably wrong here, but I suppose that can be +fixed easily. + +From pgsql-performance-owner@postgresql.org Sat Jul 30 18:06:57 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2865052AFD + for ; + Sat, 30 Jul 2005 18:06:56 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 49659-01 + for ; + Sat, 30 Jul 2005 21:06:51 +0000 (GMT) +Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) + by svr1.postgresql.org (Postfix) with ESMTP id DAECB52AC9 + for ; + Sat, 30 Jul 2005 18:06:50 -0300 (ADT) +Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net + [64.4.232.33]) (authenticated bits=0) + by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j6ULKa1q008031 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); + Sat, 30 Jul 2005 13:20:37 -0800 +Message-ID: <42EBEBE9.4020504@aptalaska.net> +Date: Sat, 30 Jul 2005 13:06:49 -0800 +From: Matthew Schumacher +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> + <42EA6966.8090402@aptalaska.net> + <1122668371.5691.352.camel@lamb.mcmillan.net.nz> + <19405.1122670917@sss.pgh.pa.us> <42EAA410.9010700@aptalaska.net> + <27897.1122748133@sss.pgh.pa.us> +In-Reply-To: <27897.1122748133@sss.pgh.pa.us> +X-Enigmail-Version: 0.91.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Spam-Bayes: Learn: unavailable +X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/496 +X-Sequence-Number: 13737 + +Tom Lane wrote: + +> I looked into this a bit. It seems that the problem when you wrap the +> entire insertion series into one transaction is associated with the fact +> that the test does so many successive updates of the single row in +> bayes_vars. (VACUUM VERBOSE at the end of the test shows it cleaning up +> 49383 dead versions of the one row.) This is bad enough when it's in +> separate transactions, but when it's in one transaction, none of those +> dead row versions can be marked "fully dead" yet --- so for every update +> of the row, the unique-key check has to visit every dead version to make +> sure it's dead in the context of the current transaction. This makes +> the process O(N^2) in the number of updates per transaction. Which is +> bad enough if you just want to do one transaction per message, but it's +> intolerable if you try to wrap the whole bulk-load scenario into one +> transaction. +> +> I'm not sure that we can do anything to make this a lot smarter, but +> in any case, the real problem is to not do quite so many updates of +> bayes_vars. +> +> How constrained are you as to the format of the SQL generated by +> SpamAssassin? In particular, could you convert the commands generated +> for a single message into a single statement? I experimented with +> passing all the tokens for a given message as a single bytea array, +> as in the attached, and got almost a factor of 4 runtime reduction +> on your test case. +> +> BTW, it's possible that this is all just a startup-transient problem: +> once the database has been reasonably well populated, one would expect +> new tokens to be added infrequently, and so the number of updates to +> bayes_vars ought to drop off. +> +> regards, tom lane +> + +The spamassassins bayes code calls the _put_token method in the storage +module a loop. This means that the storage module isn't called once per +message, but once per token. + +I'll look into modifying it to so that the bayes code passes a hash of +tokens to the storage module where they can loop or in the case of the +pgsql module pass an array of tokens to a procedure where we loop and +use temp tables to make this much more efficient. + +I don't have much time this weekend to toss at this, but will be looking +at it on Monday. + +Thanks, + +schu + +From pgsql-performance-owner@postgresql.org Sun Jul 31 02:27:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E6381528DC + for ; + Sun, 31 Jul 2005 02:27:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54321-04 + for ; + Sun, 31 Jul 2005 05:27:18 +0000 (GMT) +Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) + by svr1.postgresql.org (Postfix) with ESMTP id 50DF1528C6 + for ; + Sun, 31 Jul 2005 02:27:17 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP + id <20050731052716m9100g65jae>; Sun, 31 Jul 2005 05:27:16 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 232DE56021; Sun, 31 Jul 2005 00:27:16 -0500 (CDT) +Received: from [192.168.1.11] (liliana.arbash-meinel.com [192.168.1.11]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 6A78E56006; + Sun, 31 Jul 2005 00:27:09 -0500 (CDT) +Message-ID: <42EC612A.1080908@arbash-meinel.com> +Date: Sun, 31 Jul 2005 00:27:06 -0500 +From: John Arbash Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Matthew Schumacher +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> + <42EA6966.8090402@aptalaska.net> + <1122668371.5691.352.camel@lamb.mcmillan.net.nz> + <19405.1122670917@sss.pgh.pa.us> <42EAA410.9010700@aptalaska.net> +In-Reply-To: <42EAA410.9010700@aptalaska.net> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigFEA353E5A7E31AF4F37B27E4" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.046 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/497 +X-Sequence-Number: 13738 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigFEA353E5A7E31AF4F37B27E4 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Matthew Schumacher wrote: + +>All it's doing is trying the update before the insert to get around the +>problem of not knowing which is needed. With only 2-3 of the queries +>implemented I'm already back to running about the same speed as the +>original SA proc that is going to ship with SA 3.1.0. +> +>All of the queries are using indexes so at this point I'm pretty +>convinced that the biggest problem is the sheer number of queries +>required to run this proc 200 times for each email (once for each token). +> +>I don't see anything that could be done to make this much faster on the +>postgres end, it's looking like the solution is going to involve cutting +>down the number of queries some how. +> +>One thing that is still very puzzling to me is why this runs so much +>slower when I put the data.sql in a transaction. Obviously transactions +>are acting different when you call a proc a zillion times vs an insert +>query. +> +> +Well, I played with adding a COMMIT;BEGIN; statement to your exact test +every 1000 lines. And this is what I got: + +Unmodified: +real 17m53.587s +user 0m6.204s +sys 0m3.556s + +With BEGIN/COMMIT: +real 1m53.466s +user 0m5.203s +sys 0m3.211s + +So I see the potential for improvement almost 10 fold by switching to +transactions. I played with the perl script (and re-implemented it in +python), and for the same data as the perl script, using COPY instead of +INSERT INTO means 5s instead of 33s. + +I also played around with adding VACUUM ANALYZE every 10 COMMITS, which +brings the speed to: + +real 1m41.258s +user 0m5.394s +sys 0m3.212s + +And doing VACUUM ANALYZE every 5 COMMITS makes it: +real 1m46.403s +user 0m5.597s +sys 0m3.244s + +I'm assuming the slowdown is because of the extra time spent vacuuming. +Overall performance might still be improving, since you wouldn't +actually be inserting all 100k rows at once. + + +Just to complete the reference, the perl version runs as: +10:44:02 -- START +10:44:35 -- AFTER TEMP LOAD : loaded 120596 records +10:44:39 -- AFTER bayes_token INSERT : inserted 49359 new records into +bayes_token +10:44:41 -- AFTER bayes_vars UPDATE : updated 1 records +10:46:42 -- AFTER bayes_token UPDATE : updated 47537 records +DONE + +My python version runs as: +00:22:54 -- START +00:23:00 -- AFTER TEMP LOAD : loaded 120596 records +00:23:03 -- AFTER bayes_token INSERT : inserted 49359 new records into +bayes_token +00:23:06 -- AFTER bayes_vars UPDATE : updated 1 records +00:25:04 -- AFTER bayes_token UPDATE : updated 47537 records +DONE + +The python is effectively just a port of the perl code (with many lines +virtually unchanged), and really the only performance difference is that +the initial data load is much faster with a COPY. + +This is all run on Ubuntu, with postgres 7.4.7, and a completely +unchanged postgresql.conf. (But the machine is a dual P4 2.4GHz, with +3GB of RAM). + +John +=:-> + +>Anyway, if anyone else has any ideas I'm all ears, but at this point +>it's looking like raw query speed is needed for this app and while I +>don't care for mysql as a database, it does have the speed going for it. +> +>schu +> +>---------------------------(end of broadcast)--------------------------- +>TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> +> +> + + +--------------enigFEA353E5A7E31AF4F37B27E4 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.5 (GNU/Linux) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC7GEsJdeBCYSNAAMRAun5AKCqn5Y8W4IzbkEpE+sDSjnd1txoIgCg16zP +SwD0k//d6yrTIoy4RThIh5I= +=hEBe +-----END PGP SIGNATURE----- + +--------------enigFEA353E5A7E31AF4F37B27E4-- + +From pgsql-performance-owner@postgresql.org Sun Jul 31 02:32:13 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 67BE1528DC + for ; + Sun, 31 Jul 2005 02:32:10 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54320-05 + for ; + Sun, 31 Jul 2005 05:32:06 +0000 (GMT) +Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) + by svr1.postgresql.org (Postfix) with ESMTP id BD071528C9 + for ; + Sun, 31 Jul 2005 02:32:04 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP + id <20050731053159m9200g3vsfe>; Sun, 31 Jul 2005 05:32:04 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 5F0D556021; Sun, 31 Jul 2005 00:31:59 -0500 (CDT) +Received: from [192.168.1.11] (liliana.arbash-meinel.com [192.168.1.11]) + by juju.arbash-meinel.com (Postfix) with ESMTP id 361AC56006; + Sun, 31 Jul 2005 00:31:55 -0500 (CDT) +Message-ID: <42EC624A.2020308@arbash-meinel.com> +Date: Sun, 31 Jul 2005 00:31:54 -0500 +From: John Arbash Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Matthew Schumacher +Cc: Tom Lane , pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> + <42EA6966.8090402@aptalaska.net> + <1122668371.5691.352.camel@lamb.mcmillan.net.nz> + <19405.1122670917@sss.pgh.pa.us> <42EAA410.9010700@aptalaska.net> + <27897.1122748133@sss.pgh.pa.us> <42EBEBE9.4020504@aptalaska.net> +In-Reply-To: <42EBEBE9.4020504@aptalaska.net> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig900729736F9A409B13DA6E47" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.046 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/498 +X-Sequence-Number: 13739 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig900729736F9A409B13DA6E47 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +Matthew Schumacher wrote: + +>Tom Lane wrote: +> +> +> +>>I looked into this a bit. It seems that the problem when you wrap the +>>entire insertion series into one transaction is associated with the fact +>>that the test does so many successive updates of the single row in +>>bayes_vars. (VACUUM VERBOSE at the end of the test shows it cleaning up +>>49383 dead versions of the one row.) This is bad enough when it's in +>>separate transactions, but when it's in one transaction, none of those +>>dead row versions can be marked "fully dead" yet --- so for every update +>>of the row, the unique-key check has to visit every dead version to make +>>sure it's dead in the context of the current transaction. This makes +>>the process O(N^2) in the number of updates per transaction. Which is +>>bad enough if you just want to do one transaction per message, but it's +>>intolerable if you try to wrap the whole bulk-load scenario into one +>>transaction. +>> +>>I'm not sure that we can do anything to make this a lot smarter, but +>>in any case, the real problem is to not do quite so many updates of +>>bayes_vars. +>> +>>How constrained are you as to the format of the SQL generated by +>>SpamAssassin? In particular, could you convert the commands generated +>>for a single message into a single statement? I experimented with +>>passing all the tokens for a given message as a single bytea array, +>>as in the attached, and got almost a factor of 4 runtime reduction +>>on your test case. +>> +>>BTW, it's possible that this is all just a startup-transient problem: +>>once the database has been reasonably well populated, one would expect +>>new tokens to be added infrequently, and so the number of updates to +>>bayes_vars ought to drop off. +>> +>> regards, tom lane +>> +>> +>> +> +>The spamassassins bayes code calls the _put_token method in the storage +>module a loop. This means that the storage module isn't called once per +>message, but once per token. +> +> +Well, putting everything into a transaction per email might make your +pain go away. +If you saw the email I just sent, I modified your data.sql file to add a +"COMMIT;BEGIN" every 1000 selects, and I saw a performance jump from 18 +minutes down to less than 2 minutes. Heck, on my machine, the advanced +perl version takes more than 2 minutes to run. It is actually slower +than the data.sql with commit statements. + +>I'll look into modifying it to so that the bayes code passes a hash of +>tokens to the storage module where they can loop or in the case of the +>pgsql module pass an array of tokens to a procedure where we loop and +>use temp tables to make this much more efficient. +> +> +Well, you could do that. Or you could just have the bayes code issue +"BEGIN;" when it starts processing an email, and a "COMMIT;" when it +finishes. From my testing, you will see an enormous speed improvement. +(And you might consider including a fairly frequent VACUUM ANALYZE) + +>I don't have much time this weekend to toss at this, but will be looking +>at it on Monday. +> +> +Good luck, +John +=:-> + +>Thanks, +> +>schu +> +>---------------------------(end of broadcast)--------------------------- +>TIP 5: don't forget to increase your free space map settings +> +> +> + + +--------------enig900729736F9A409B13DA6E47 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.5 (GNU/Linux) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC7GJKJdeBCYSNAAMRAhehAJ0b7M1ZFaA3lkvkgxsDgnZrAPc8oACgksHm +dOogxce0sXl1qIFC6MMwDXo= +=Pb5C +-----END PGP SIGNATURE----- + +--------------enig900729736F9A409B13DA6E47-- + +From pgsql-performance-owner@postgresql.org Sun Jul 31 07:11:24 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C44C952835 + for ; + Sun, 31 Jul 2005 07:11:22 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09876-01 + for ; + Sun, 31 Jul 2005 10:11:17 +0000 (GMT) +Received: from mail2.aeccom.com (port-212-202-101-158.static.qsc.de + [212.202.101.158]) + by svr1.postgresql.org (Postfix) with ESMTP id F04B95280C + for ; + Sun, 31 Jul 2005 07:11:15 -0300 (ADT) +Received: from [192.168.2.132] (openvpn02.core.aeccom.com [192.168.2.132]) + by mail2.aeccom.com (Postfix) with ESMTP + id C4EF8EC; Sun, 31 Jul 2005 12:11:15 +0200 (CEST) +Message-ID: <42ECA3B6.3000607@aeccom.com> +Date: Sun, 31 Jul 2005 12:11:02 +0200 +From: =?ISO-8859-1?Q?Dirk_Lutzeb=E4ck?= +Reply-To: lutzeb@aeccom.com +User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Jeffrey W. Baker" +Cc: josh@agliodbs.com, pgsql-performance@postgresql.org, + Sven Geisler +Subject: Re: Performance problems on 4/8way Opteron (dualcore) HP +References: <42EA5D18.9020204@aeccom.com> + <200507291046.10318.josh@agliodbs.com> + <1122663342.6814.5.camel@toonses.gghcwest.com> +In-Reply-To: <1122663342.6814.5.camel@toonses.gghcwest.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/499 +X-Sequence-Number: 13740 + +Hi Jeff, + +which box are you running precisely and which OS/kernel? + +We need to run 32bit because we need failover to 32 bit XEON system +(DL580). If this does not work out we probably need to switch to 64 bit +(dump/restore) and run a nother 64bit failover box too. + +Regards, + +Dirk + + + +Jeffrey W. Baker wrote: +> On Fri, 2005-07-29 at 10:46 -0700, Josh Berkus wrote: +> +>>Dirk, +>> +>> +>>>does anybody have expierence with this machine (4x 875 dual core Opteron +>>>CPUs)? +> +> +> I'm using dual 275s without problems. +> +> +>>Nope. I suspect that you may be the first person to report in on +>>dual-cores. There may be special compile issues with dual-cores that +>>we've not yet encountered. +> +> +> Doubtful. However you could see improvements using recent Linux kernel +> code. There have been some patches for optimizing scheduling and memory +> allocations. +> +> However, if you are running this machine in 32-bit mode, why did you +> bother paying $14,000 for your CPUs? You will get FAR better +> performance in 64-bit mode. 64-bit mode will give you 30-50% better +> performance on PostgreSQL loads, in my experience. Also, if I remember +> correctly, the 32-bit x86 kernel doesn't understand Opteron NUMA +> topology, so you may be seeing poor memory allocation decisions. +> +> -jwb +> +> +>>>We run RHEL 3.0, 32bit and under high load it is a drag. We +>>>mostly run memory demanding queries. Context switches are pretty much +>>>around 20.000 on the average, no cs spikes when we run many processes in +>>>parallel. Actually we only see two processes in running state! When +>>>there are only a few processes running context switches go much higher. +>>>At the moment we are much slower that with a 4way XEON box (DL580). +>> +>>Um, that was a bit incoherent. Are you seeing a CS storm or aren't you? +>> + + +From pgsql-performance-owner@postgresql.org Sun Jul 31 07:12:53 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 798ED52871 + for ; + Sun, 31 Jul 2005 07:12:51 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04661-08 + for ; + Sun, 31 Jul 2005 10:12:46 +0000 (GMT) +Received: from mail2.aeccom.com (port-212-202-101-158.static.qsc.de + [212.202.101.158]) + by svr1.postgresql.org (Postfix) with ESMTP id EAC295286E + for ; + Sun, 31 Jul 2005 07:12:43 -0300 (ADT) +Received: from [192.168.2.132] (openvpn02.core.aeccom.com [192.168.2.132]) + by mail2.aeccom.com (Postfix) with ESMTP + id D66D2EC; Sun, 31 Jul 2005 12:12:44 +0200 (CEST) +Message-ID: <42ECA410.7020804@aeccom.com> +Date: Sun, 31 Jul 2005 12:12:32 +0200 +From: =?ISO-8859-1?Q?Dirk_Lutzeb=E4ck?= +Reply-To: lutzeb@aeccom.com +User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "J. Andrew Rogers" +Cc: josh@agliodbs.com, pgsql-performance@postgresql.org, + Sven Geisler +Subject: Re: Performance problems on 4/8way Opteron (dualcore) HP +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/500 +X-Sequence-Number: 13741 + +Anybody knows if RedHat is already supporting this patch on an +enterprise version? + +Regards, + +Dirk + + + +J. Andrew Rogers wrote: +> On 7/29/05 10:46 AM, "Josh Berkus" wrote: +> +>>>does anybody have expierence with this machine (4x 875 dual core Opteron +>>>CPUs)? +>> +>>Nope. I suspect that you may be the first person to report in on +>>dual-cores. There may be special compile issues with dual-cores that +>>we've not yet encountered. +> +> +> +> There was recently a discussion of similar types of problems on a couple of +> the supercomputing lists, regarding surprisingly substandard performance +> from large dual-core opteron installations. +> +> The problem as I remember it boiled down to the Linux kernel handling +> memory/process management very badly on large dual core systems -- +> pathological NUMA behavior. However, this problem has apparently been fixed +> in Linux v2.6.12+, and using the more recent kernel on large dual core +> systems generated *massive* performance improvements on these systems for +> the individuals with this issue. Using the patched kernel, one gets the +> performance most people were expecting. +> +> The v2.6.12+ kernels are a bit new, but they contain a very important +> performance patch for systems like the one above. It would definitely be +> worth testing if possible. +> +> +> J. Andrew Rogers +> +> + + +From pgsql-performance-owner@postgresql.org Sun Jul 31 12:29:29 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C88B55284A + for ; + Sun, 31 Jul 2005 12:29:27 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92472-07 + for ; + Sun, 31 Jul 2005 15:29:18 +0000 (GMT) +Received: from mx1.neopolitan.us (mx1.neopolitan.us [65.87.16.224]) + by svr1.postgresql.org (Postfix) with ESMTP id B84345288D + for ; + Sun, 31 Jul 2005 12:29:16 -0300 (ADT) +Received: from [64.173.27.113] (HELO [192.168.2.45]) + by mx1.neopolitan.us (CommuniGate Pro SMTP 4.2.10) + with ESMTP id 10180932 for pgsql-performance@postgresql.org; + Sun, 31 Jul 2005 08:29:15 -0700 +User-Agent: Microsoft-Entourage/11.1.0.040913 +Date: Sun, 31 Jul 2005 08:29:15 -0700 +Subject: Re: Performance problems on 4/8way Opteron (dualcore) +From: "J. Andrew Rogers" +To: +Message-ID: +In-Reply-To: +Mime-version: 1.0 +Content-type: text/plain; + charset="US-ASCII" +Content-transfer-encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.312 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST +X-Spam-Level: * +X-Archive-Number: 200507/501 +X-Sequence-Number: 13742 + +On 7/30/05 12:57 AM, "William Yu" wrote: +> I haven't investigated the 2.6.12+ kernel updates yet -- I probably will +> do our development servers first to give it a test. + + +The kernel updates make the NUMA code dual-core aware, which apparently +makes a big difference in some cases but not in others. It makes some +sense, since multi-processor multi-core machines will have two different +types of non-locality instead of just one that need to be managed. Prior to +the v2.6.12 patches, a dual-core dual-proc machine was viewed as a quad-proc +machine. + +The closest thing to a supported v2.6.12 kernel that I know of is FC4, which +is not really supported in the enterprise sense of course. + + +J. Andrew Rogers + + + +From pgsql-performance-owner@postgresql.org Sun Jul 31 12:52:50 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7541F528A8 + for ; + Sun, 31 Jul 2005 12:52:37 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96355-10 + for ; + Sun, 31 Jul 2005 15:52:29 +0000 (GMT) +Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) + by svr1.postgresql.org (Postfix) with ESMTP id 0EE8552838 + for ; + Sun, 31 Jul 2005 12:52:27 -0300 (ADT) +Received: from juju.arbash-meinel.com ([12.214.18.81]) + by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP + id <20050731155226m9100g5rcne>; Sun, 31 Jul 2005 15:52:26 +0000 +Received: by juju.arbash-meinel.com (Postfix, from userid 505) + id 8485055FFF; Sun, 31 Jul 2005 10:52:25 -0500 (CDT) +Received: from [192.168.1.11] (liliana.arbash-meinel.com [192.168.1.11]) + by juju.arbash-meinel.com (Postfix) with ESMTP id B990655F9F; + Sun, 31 Jul 2005 10:52:18 -0500 (CDT) +Message-ID: <42ECF3AE.6060809@arbash-meinel.com> +Date: Sun, 31 Jul 2005 10:52:14 -0500 +From: John Arbash Meinel +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: John Arbash Meinel +Cc: Matthew Schumacher , + pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> + <42EA6966.8090402@aptalaska.net> + <1122668371.5691.352.camel@lamb.mcmillan.net.nz> + <19405.1122670917@sss.pgh.pa.us> <42EAA410.9010700@aptalaska.net> + <42EC612A.1080908@arbash-meinel.com> +In-Reply-To: <42EC612A.1080908@arbash-meinel.com> +X-Enigmail-Version: 0.92.0.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigE3AA658B8D7F7F80FBA76421" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.046 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/502 +X-Sequence-Number: 13743 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigE3AA658B8D7F7F80FBA76421 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + +John Arbash Meinel wrote: + +>Matthew Schumacher wrote: +> +> +> +>>All it's doing is trying the update before the insert to get around the +>>problem of not knowing which is needed. With only 2-3 of the queries +>>implemented I'm already back to running about the same speed as the +>>original SA proc that is going to ship with SA 3.1.0. +>> +>>All of the queries are using indexes so at this point I'm pretty +>>convinced that the biggest problem is the sheer number of queries +>>required to run this proc 200 times for each email (once for each token). +>> +>>I don't see anything that could be done to make this much faster on the +>>postgres end, it's looking like the solution is going to involve cutting +>>down the number of queries some how. +>> +>>One thing that is still very puzzling to me is why this runs so much +>>slower when I put the data.sql in a transaction. Obviously transactions +>>are acting different when you call a proc a zillion times vs an insert +>>query. +>> +>> +>> +>> +>Well, I played with adding a COMMIT;BEGIN; statement to your exact test +>every 1000 lines. And this is what I got: +> +> +Just for reference, I also tested this on my old server, which is a dual +Celeron 450 with 256M ram. FC4 and Postgres 8.0.3 +Unmodified: +real 54m15.557s +user 0m24.328s +sys 0m14.200s + +With Transactions every 1000 selects, and vacuum every 5000: +real 8m36.528s +user 0m16.585s +sys 0m12.569s + +With Transactions every 1000 selects, and vacuum every 10000: +real 7m50.748s +user 0m16.183s +sys 0m12.489s + +On this machine vacuum is more expensive, since it doesn't have as much ram. + +Anyway, on this machine, I see approx 7x improvement. Which I think is +probably going to satisfy your spamassassin needs. +John +=:-> + +PS> Looking forward to having a spamassassin that can utilize my +favorite db. Right now, I'm not using a db backend because it wasn't +worth setting up mysql. + +>Unmodified: +>real 17m53.587s +>user 0m6.204s +>sys 0m3.556s +> +>With BEGIN/COMMIT: +>real 1m53.466s +>user 0m5.203s +>sys 0m3.211s +> +>So I see the potential for improvement almost 10 fold by switching to +>transactions. I played with the perl script (and re-implemented it in +>python), and for the same data as the perl script, using COPY instead of +>INSERT INTO means 5s instead of 33s. +> +>I also played around with adding VACUUM ANALYZE every 10 COMMITS, which +>brings the speed to: +> +>real 1m41.258s +>user 0m5.394s +>sys 0m3.212s +> +>And doing VACUUM ANALYZE every 5 COMMITS makes it: +>real 1m46.403s +>user 0m5.597s +>sys 0m3.244s +> +>I'm assuming the slowdown is because of the extra time spent vacuuming. +>Overall performance might still be improving, since you wouldn't +>actually be inserting all 100k rows at once. +> +> +... + +>This is all run on Ubuntu, with postgres 7.4.7, and a completely +>unchanged postgresql.conf. (But the machine is a dual P4 2.4GHz, with +>3GB of RAM). +> +>John +>=:-> +> +> + + +--------------enigE3AA658B8D7F7F80FBA76421 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.5 (GNU/Linux) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFC7POyJdeBCYSNAAMRAiUjAJ9x+Q961uI0MY/Og+GK6ZgnAPsz7gCgmuuZ +MpgRe2BiJP60c44Qcph6BRY= +=mjjm +-----END PGP SIGNATURE----- + +--------------enigE3AA658B8D7F7F80FBA76421-- + +From pgsql-performance-owner@postgresql.org Sun Jul 31 13:51:21 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 842A35286F + for ; + Sun, 31 Jul 2005 13:51:19 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37578-09 + for ; + Sun, 31 Jul 2005 16:51:10 +0000 (GMT) +Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) + by svr1.postgresql.org (Postfix) with ESMTP id 6861752833 + for ; + Sun, 31 Jul 2005 13:51:09 -0300 (ADT) +Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net + [64.4.232.33]) (authenticated bits=0) + by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j6VH54R5026900 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) + for ; Sun, 31 Jul 2005 09:05:04 -0800 +Message-ID: <42ED017A.2050207@aptalaska.net> +Date: Sun, 31 Jul 2005 08:51:06 -0800 +From: Matthew Schumacher +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <42E80C28.2040608@aptalaska.net> + <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> + <42EA6966.8090402@aptalaska.net> + <1122668371.5691.352.camel@lamb.mcmillan.net.nz> + <19405.1122670917@sss.pgh.pa.us> <42EAA410.9010700@aptalaska.net> + <42EC612A.1080908@arbash-meinel.com> + <42ECF3AE.6060809@arbash-meinel.com> +In-Reply-To: <42ECF3AE.6060809@arbash-meinel.com> +X-Enigmail-Version: 0.91.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Spam-Bayes: Learn: ham +X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/503 +X-Sequence-Number: 13744 + +Ok, here is the current plan. + +Change the spamassassin API to pass a hash of tokens into the storage +module, pass the tokens to the proc as an array, start a transaction, +load the tokens into a temp table using copy, select the tokens distinct +into the token table for new tokens, update the token table for known +tokens, then commit. + +This solves the following problems: + +1. Each email is a transaction instead of each token. +2. The update statement is only called when we really need an update +which avoids all of those searches. +3. The looping work is done inside the proc instead of perl calling a +method a zillion times per email. + +I'm not sure how vacuuming will be done yet, if we vacuum once per email +that may be too often, so I may do that every 5 mins in cron. + +schu + +From pgsql-performance-owner@postgresql.org Sun Jul 31 14:10:20 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 85B9E52B23 + for ; + Sun, 31 Jul 2005 14:10:17 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68524-01 + for ; + Sun, 31 Jul 2005 17:10:14 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 9596A52B19 + for ; + Sun, 31 Jul 2005 14:10:13 -0300 (ADT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id BEE3015252; Sun, 31 Jul 2005 12:10:12 -0500 (CDT) +Date: Sun, 31 Jul 2005 12:10:12 -0500 +From: "Jim C. Nasby" +To: Matthew Schumacher +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +Message-ID: <20050731171012.GS60019@decibel.org> +References: <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> + <42EA6966.8090402@aptalaska.net> + <1122668371.5691.352.camel@lamb.mcmillan.net.nz> + <19405.1122670917@sss.pgh.pa.us> <42EAA410.9010700@aptalaska.net> + <42EC612A.1080908@arbash-meinel.com> + <42ECF3AE.6060809@arbash-meinel.com> + <42ED017A.2050207@aptalaska.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <42ED017A.2050207@aptalaska.net> +X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.9i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/504 +X-Sequence-Number: 13745 + +On Sun, Jul 31, 2005 at 08:51:06AM -0800, Matthew Schumacher wrote: +> Ok, here is the current plan. +> +> Change the spamassassin API to pass a hash of tokens into the storage +> module, pass the tokens to the proc as an array, start a transaction, +> load the tokens into a temp table using copy, select the tokens distinct +> into the token table for new tokens, update the token table for known +> tokens, then commit. + +You might consider: +UPDATE tokens + FROM temp_table (this updates existing records) + +INSERT INTO tokens + SELECT ... + FROM temp_table + WHERE NOT IN (SELECT ... FROM tokens) + +This way you don't do an update to newly inserted tokens, which helps +keep vacuuming needs in check. + +> This solves the following problems: +> +> 1. Each email is a transaction instead of each token. +> 2. The update statement is only called when we really need an update +> which avoids all of those searches. +> 3. The looping work is done inside the proc instead of perl calling a +> method a zillion times per email. +> +> I'm not sure how vacuuming will be done yet, if we vacuum once per email +> that may be too often, so I may do that every 5 mins in cron. + +I would suggest leaving an option to have SA vacuum every n emails, +since some people may not want to mess with cron, etc. I suspect that +pg_autovacuum would be able to keep up with things pretty well, though. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +Give your computer some brain candy! www.distributed.net Team #1828 + +Windows: "Where do you want to go today?" +Linux: "Where do you want to go tomorrow?" +FreeBSD: "Are you guys coming, or what?" + +From pgsql-performance-owner@postgresql.org Sun Jul 31 15:19:28 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C7D5E528FF + for ; + Sun, 31 Jul 2005 15:19:24 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07626-10 + for ; + Sun, 31 Jul 2005 18:19:15 +0000 (GMT) +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.187]) + by svr1.postgresql.org (Postfix) with ESMTP id C9CF652825 + for ; + Sun, 31 Jul 2005 15:19:13 -0300 (ADT) +Received: from p548F13E4.dip0.t-ipconnect.de [84.143.19.228] + (helo=pse.dyndns.org) + by mrelayeu.kundenserver.de with ESMTP (Nemesis), + id 0MKwtQ-1DzIP31j2N-0006Hv; Sun, 31 Jul 2005 20:19:13 +0200 +Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) + id 1DzIP1-0001z5-Vg; Sun, 31 Jul 2005 20:19:12 +0200 +Message-ID: <42ED161F.1020408@pse-consulting.de> +Date: Sun, 31 Jul 2005 20:19:11 +0200 +From: Andreas Pflug +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Jim C. Nasby" +Cc: Matthew Schumacher , + pgsql-performance@postgresql.org +Subject: Re: Performance problems testing with Spamassassin 3.1.0 +References: <1122532023.25574.1.camel@localhost.localdomain> + <42E9749F.6000709@aptalaska.net> + <1122616211.5691.340.camel@lamb.mcmillan.net.nz> + <42EA6966.8090402@aptalaska.net> + <1122668371.5691.352.camel@lamb.mcmillan.net.nz> + <19405.1122670917@sss.pgh.pa.us> <42EAA410.9010700@aptalaska.net> + <42EC612A.1080908@arbash-meinel.com> + <42ECF3AE.6060809@arbash-meinel.com> + <42ED017A.2050207@aptalaska.net> + <20050731171012.GS60019@decibel.org> +In-Reply-To: <20050731171012.GS60019@decibel.org> +X-Enigmail-Version: 0.89.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:0ce7ee5c3478b8d72edd8e05ccd40b70 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.272 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200507/505 +X-Sequence-Number: 13746 + +Jim C. Nasby wrote: +> On Sun, Jul 31, 2005 at 08:51:06AM -0800, Matthew Schumacher wrote: +> +>>Ok, here is the current plan. +>> +>>Change the spamassassin API to pass a hash of tokens into the storage +>>module, pass the tokens to the proc as an array, start a transaction, +>>load the tokens into a temp table using copy, select the tokens distinct +>>into the token table for new tokens, update the token table for known +>>tokens, then commit. +> +> +> You might consider: +> UPDATE tokens +> FROM temp_table (this updates existing records) +> +> INSERT INTO tokens +> SELECT ... +> FROM temp_table +> WHERE NOT IN (SELECT ... FROM tokens) +> +> This way you don't do an update to newly inserted tokens, which helps +> keep vacuuming needs in check. + +The subselect might be quite a big set, so avoiding a full table scan +and materialization by + +DELETE temp_table + WHERE key IN (select key FROM tokens JOIN temp_table); +INSERT INTO TOKENS SELECT * FROM temp_table; + +or + +INSERT INTO TOKENS +SELECT temp_table.* FROM temp_table LEFT JOIN tokens USING (key) +WHERE tokens.key IS NULL + +might be an additional win, assuming that only a small fraction of +tokens is inserted and updated. + +Regards, +Andreas + +From pgsql-performance-owner@postgresql.org Sun Jul 31 18:12:16 2005 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C8DF0529B6 + for ; + Sun, 31 Jul 2005 18:12:14 -0300 (ADT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37050-03 + for ; + Sun, 31 Jul 2005 21:12:05 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 6C8CF529AA + for ; + Sun, 31 Jul 2005 18:12:03 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id BB3BB3095A; Sun, 31 Jul 2005 23:20:15 +0200 (MET DST) +From: William Yu +X-Newsgroups: pgsql.performance +Subject: Re: Performance problems on 4/8way Opteron (dualcore) +Date: Sun, 31 Jul 2005 14:11:58 -0700 +Organization: Hub.Org Networking Services +Lines: 30 +Message-ID: +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) +X-Accept-Language: en-us, en +In-Reply-To: +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.017 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200507/506 +X-Sequence-Number: 13747 + +A 4xDC would be far more sensitive to poor NUMA code than 2xDC so I'm +not surprised I don't see performance issues on our 2xDC w/ < 2.6.12. + + +J. Andrew Rogers wrote: +> On 7/30/05 12:57 AM, "William Yu" wrote: +> +>>I haven't investigated the 2.6.12+ kernel updates yet -- I probably will +>>do our development servers first to give it a test. +> +> +> +> The kernel updates make the NUMA code dual-core aware, which apparently +> makes a big difference in some cases but not in others. It makes some +> sense, since multi-processor multi-core machines will have two different +> types of non-locality instead of just one that need to be managed. Prior to +> the v2.6.12 patches, a dual-core dual-proc machine was viewed as a quad-proc +> machine. +> +> The closest thing to a supported v2.6.12 kernel that I know of is FC4, which +> is not really supported in the enterprise sense of course. +> +> +> J. Andrew Rogers +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster +> +