Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 862D41FA2A4B for ; Thu, 26 Jul 2012 05:25:43 -0300 (ADT) Received: from mail-yx0-f174.google.com ([209.85.213.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SuJO9-0007YK-I9 for pgsql-admin@postgresql.org; Thu, 26 Jul 2012 08:25:43 +0000 Received: by yenl2 with SMTP id l2so1667443yen.19 for ; Thu, 26 Jul 2012 01:25:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=ZkTIvhJ/4aRIrzO0It1mwDBMFnZkhhmIRWjePySCKoQ=; b=pRsD1KLDHc7dfDWH3HE/I6aigdqRygxmDKCIWLLjnLcNK/AF39pisvKgfcr62/TvPu OX5xelIInWbajTMDEdtKD71qrKCX1OVSHqo5f0s2L/QQEkMRkne8s0KJgtBicSrqDyMe PrdJOKNHi9pdxUjpryQQBuiwuOvV/gmIvDnraEGt/xDsPzaYKdHUJY38z4mUAn1vZamp 7ZfTh7Nw9Cxd+eGNU0kVkxfx99LXbSD5+3JaKSbOURZ3UX4RlPXwQ/nhSW8dvvfKGjvq 98MIg8aXnurXbve8JiUlvhztSuYZK67PNJ/h23aGENhsWMHJxtjjR23WECyHMGyxwNmX EMzg== Received: by 10.66.75.225 with SMTP id f1mr18786534paw.35.1343291127663; Thu, 26 Jul 2012 01:25:27 -0700 (PDT) Received: from ayaki.localdomain (office1.postnewspapers.com.au. [150.101.171.128]) by mx.google.com with ESMTPS id mc3sm16108761pbc.12.2012.07.26.01.25.25 (version=SSLv3 cipher=OTHER); Thu, 26 Jul 2012 01:25:26 -0700 (PDT) Message-ID: <5010FEF2.3050901@ringerc.id.au> Date: Thu, 26 Jul 2012 16:25:22 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: Thomas Markus CC: pgsql-admin@postgresql.org Subject: Re: problems with access into system catalogs References: <5010F555.9020209@proventis.net> In-Reply-To: <5010F555.9020209@proventis.net> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnuqT2ZYFx2OWAy0HHb8jl38mZayBY/ZTrJyvhcivfMnpSfdhPJcOpe8o9r/ZtsQVCHqfR9 X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/81 X-Sequence-Number: 39798 First, thank-you for an excellent complete question with versions, EXPLAIN ANALYZE, and exact messages. My reply is interleaved below. On 07/26/2012 03:44 PM, Thomas Markus wrote: > I have 2 systems with CentOS 5.5 (2.6.18) x86_64, postgresql-9.0.6 64bit > > both systems contains the same content. But one system make troubles. > some system tables (eg pg_catalog.pg_class or pg_attribute) contain > much dead rows and all simple query take much time on one system. the > other one is fast. [snip] > other: > INFO: "pg_class": found 0 removable, 1547667 nonremovable row > versions in 31587 out of 31587 pages > DETAIL: 1545530 dead row versions cannot be removed yet. > > a "select count(*) from pg_catalog.pg_class" returns only 2137 > OK, so you have lots of bloat in the system catalogs. A few things to check for: - Do you have any uncommitted two phase transactions? Run: SELECT * from pg_prepared_xacts ; - Do you have any long-lived 'IDLE IN TRANSACTION' connections ? Try: SELECT * FROM pg_stat_activity WHERE current_query = ' in transaction' AND xact_start > current_timestamp - '1 minute'::interval; Either of those can prevent vacuum from cleaning things up. Do you very frequently create and drop tables, indexes, etc? Say, using a database unit testing framework? -- Craig Ringer