Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YuJuk-0000FJ-No for pgsql-bugs@arkaria.postgresql.org; Mon, 18 May 2015 12:12:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YuJuj-0001xa-S1 for pgsql-bugs@arkaria.postgresql.org; Mon, 18 May 2015 12:12:57 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YuJui-0001xT-Q5 for pgsql-bugs@postgresql.org; Mon, 18 May 2015 12:12:56 +0000 Received: from andy.depesz.com ([88.198.47.100] helo=depesz.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1YuJuf-00050t-9x for pgsql-bugs@postgresql.org; Mon, 18 May 2015 12:12:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20140207; h=Content-Type:MIME-Version:Reply-To:Message-ID:Subject:To:Sender:From:Date; bh=e6gVfymCTNFkEjP2Hcse68HMIc1WbSEFo/iUeU/GntQ=; b=v5UDl3wuUEOXcoEJCqO7N7+Ubqpe4e95sP+kyh4Hhu2VT2Vw4uwcuf5V8NKZE+10oBBJ3/LjS0zfk/sXkAOzU6jQiJLhemp1dWMpH3LNhpPw3VHCIBiZuI7mncrD8tye; Received: from andy.depesz.com ([88.198.47.100] helo=depesz.com) by depesz.com with esmtpa (Exim 4.85) (envelope-from ) id 1YuJuc-0000Ts-E5 for pgsql-bugs@postgresql.org; Mon, 18 May 2015 14:12:50 +0200 Date: Mon, 18 May 2015 14:12:50 +0200 From: hubert depesz lubaczewski To: pgsql-bugs Subject: GiST index for pgtrgm bloats a lot Message-ID: <20150518121250.GA19976@depesz.com> Reply-To: depesz@depesz.com MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hi, We have this situation on many servers - used versions are 9.1.14 and/or 9.3.6, on Linux servers. There is a table, with ~ 1 million rows. There are no deletes there, inserts happen at the rate of ~ 100-200 daily (but not spread, it's usually a single moment in day where there happen the inserts). There is also HUGE number of updates - up to 200,000 rows updated per hour. Schema of the table: Table "schemaXX.tableYY" Column | Type | Modifiers --------------------------------------+-----------------------------+--------------------------------------------------------------- id | bigint | not null default nextval('schemaXX.tableYY_id_seq'::regclass) col_a | character varying(255) | ............................... | bigint | not null ............................... | character varying(255) | ............................... | bigint | ............................... | character varying(255) | not null ............................... | character varying(255) | ............................... | timestamp without time zone | ............................... | timestamp without time zone | ............................... | bigint | ............................... | boolean | ............................... | boolean | ............................... | timestamp without time zone | ............................... | timestamp without time zone | ............................... | boolean | ............................... | text | ............................... | boolean | default false ............................... | character varying(255) | ............................... | bigint | ............................... | boolean | default true col_c | character varying(255) | ............................... | character varying(255) | default '----'::character varying ............................... | bigint | ............................... | bigint | not null ............................... | bigint | not null col_b | character varying(255) | ............................... | bigint | ............................... | boolean | ............................... | boolean | ............................... | bigint | ............................... | text | ............................... | boolean | ............................... | text | ............................... | boolean | ............................... | character varying(255) | ............................... | boolean | ............................... | boolean | ............................... | bigint | ............................... | character varying(255) | ............................... | text | ............................... | bigint | ............................... | text | ............................... | text | ............................... | character varying(255) | ............................... | integer | ............................... | character varying(255) | ............................... | character varying(255) | ............................... | character varying(255) | ............................... | bigint | indexes: There are 17 indexes in total, and the problematic is: "index_trgm_courses_composite_search" gist (((((COALESCE(lower(col_a::text), ''::text) || ' '::text) || COALESCE(lower(col_b::text), ''::text)) || ' '::text) || COALESCE(lower(col_c::text), ''::text)) gist_trgm_ops) On 2015-04-27 this index was reindexed. It's size (relpages as shown in pg_class) dropped from 152698 to 45865. Since then the index is consistently increasing in size. Today it was 343370 pages, and after reindex it dropped to 29091. On these databases we have some (not many) 1-2 minute transactions, but usually every transaction within 30 seconds This table is vacuumed (autovacuum) quite a lot, usually at least 10 times a day. Is there anything we could do to help diagnose the problem, and fix it? I don't think I can install custom pg version, and downtime would be complicated to get approval, but anything about the data/database I can check that would allow diagnosing the bug, I'd be happy to do. depesz -- The best thing about modern society is how easy it is to avoid contact with it. http://depesz.com/ -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs