Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 1682F9FB274 for ; Tue, 3 Jul 2007 14:32:55 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 32581-08 for ; Tue, 3 Jul 2007 14:32:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mx00.pub.collaborativefusion.com (mx00.pub.collaborativefusion.com [206.210.89.199]) by postgresql.org (Postfix) with ESMTP id 024FC9FB235 for ; Tue, 3 Jul 2007 14:32:49 -0300 (ADT) Received: from vanquish.pgh.priv.collaborativefusion.com (vanquish.pgh.priv.collaborativefusion.com [192.168.2.61]) (SSL: TLSv1/SSLv3,256bits,AES256-SHA) by wingspan with esmtp; Tue, 03 Jul 2007 13:32:48 -0400 id 00056428.468A8840.0000072C Date: Tue, 3 Jul 2007 13:32:48 -0400 From: Bill Moran To: smiley2211 Cc: pgsql-performance@postgresql.org Subject: Re: Query is taking 5 HOURS to Complete on 8.1 version Message-Id: <20070703133248.c6733d2f.wmoran@collaborativefusion.com> In-Reply-To: <11416966.post@talk.nabble.com> References: <11416966.post@talk.nabble.com> Organization: Collaborative Fusion X-Mailer: Sylpheed 2.3.1 (GTK+ 2.10.11; i386-portbld-freebsd6.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/18 X-Sequence-Number: 25702 In response to smiley2211 : > > This query is taking less than 5 minutes on 7.4 but over 5 hours on 8.1... > > PostgreSQL 8.1.4 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) > 4.1.0 (SUSE Linux) > Total runtime: 20448310.101 ms = 5.6800862 hour > (132 rows) When was the last time you vacuum analyzed the database? Also, you don't even provide the query. I can't imagine how you'd expect anyone to help you. If vacuum analyze doesn't fix the problem, please provide the query, explain output of the query, and the schema of any tables involved, including information on indexes. > > --postgresql.conf: > > shared_buffers = 114688 # min 16 or max_connections*2, 8KB > each > #temp_buffers = 20000 # min 100, 8KB each > #max_prepared_transactions = 5 # can be 0 or more > # note: increasing max_prepared_transactions costs ~600 bytes of shared > memory > # per transaction slot, plus lock space (see max_locks_per_transaction). > work_mem = 10240 # size in KB > maintenance_work_mem = 64384 # min 1024, size in KB > max_stack_depth = 4096 # min 100, size in KB > > # - Free Space Map - > > max_fsm_pages = 500000 # min max_fsm_relations*16, 6 bytes each > max_fsm_relations = 1000 # min 100, ~70 bytes each > > # - Kernel Resource Usage - > > #max_files_per_process = 1000 # min 25 > #preload_libraries = '' > > # - Cost-Based Vacuum Delay - > > #vacuum_cost_delay = 0 # 0-1000 milliseconds > #vacuum_cost_page_hit = 1 # 0-10000 credits > #vacuum_cost_page_miss = 10 # 0-10000 credits > #vacuum_cost_page_dirty = 20 # 0-10000 credits > #vacuum_cost_limit = 200 # 0-10000 credits > > # - Background writer - > > #bgwriter_delay = 200 # 10-10000 milliseconds between > rounds > #bgwriter_lru_percent = 1.0 # 0-100% of LRU buffers > scanned/round > #bgwriter_lru_maxpages = 5 # 0-1000 buffers max written/round > #bgwriter_all_percent = 0.333 # 0-100% of all buffers > scanned/round > #bgwriter_all_maxpages = 5 # 0-1000 buffers max written/round > > > #--------------------------------------------------------------------------- > # WRITE AHEAD LOG > #--------------------------------------------------------------------------- > > # - Settings - > > #fsync = on # turns forced synchronization on or > off > #wal_sync_method = fsync # the default is the first option > # supported by the operating system: > # open_datasync > # fdatasync > # fsync > # fsync_writethrough > # open_sync > #full_page_writes = on # recover from partial page writes > #wal_buffers = 8 # min 4, 8KB each > #commit_delay = 0 # range 0-100000, in microseconds > #commit_siblings = 5 # range 1-1000 > > # - Checkpoints - > > checkpoint_segments = 12 # in logfile segments, min 1, 16MB > each > #checkpoint_timeout = 300 # range 30-3600, in seconds > #checkpoint_warning = 30 # in seconds, 0 is off > > # - Archiving - > > #archive_command = '' # command to use to archive a > logfile > # segment > > > #--------------------------------------------------------------------------- > # QUERY TUNING > #--------------------------------------------------------------------------- > > # - Planner Method Configuration - > > enable_bitmapscan = off > enable_hashagg = on > enable_hashjoin = on > enable_indexscan = on > enable_mergejoin = on > enable_nestloop = on > enable_seqscan = off > enable_sort = on > enable_tidscan = on > > # - Planner Cost Constants - > > effective_cache_size = 10000 # typically 8KB each > random_page_cost = 4 # units are one sequential page > fetch > # cost > #cpu_tuple_cost = 0.01 # (same) > #cpu_index_tuple_cost = 0.001 # (same) > #cpu_operator_cost = 0.0025 # (same) > #--------------------------------------------------------------------------- > # LOCK MANAGEMENT > #--------------------------------------------------------------------------- > > #deadlock_timeout = 1000 # in milliseconds > #max_locks_per_transaction = 64 # min 10 > # note: each lock table slot uses ~220 bytes of shared memory, and there are > # max_locks_per_transaction * (max_connections + max_prepared_transactions) > # lock table slots. > -- Bill Moran Collaborative Fusion Inc. http://people.collaborativefusion.com/~wmoran/ wmoran@collaborativefusion.com Phone: 412-422-3463x4023