X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E9A1553DC0 for ; Fri, 22 Apr 2005 05:44: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 53181-09 for ; Fri, 22 Apr 2005 08:44:10 +0000 (GMT) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by svr1.postgresql.org (Postfix) with ESMTP id 57859531DF for ; Fri, 22 Apr 2005 05:44:09 -0300 (ADT) Received: from frontend3.messagingengine.com (frontend3.internal [10.202.2.152]) by frontend1.messagingengine.com (Postfix) with ESMTP id 4009AC77113; Fri, 22 Apr 2005 04:44:11 -0400 (EDT) X-Sasl-enc: h2bd2TYZnenNhYVW8aNn9OJ3Vf38rU1zTAtpkmMuR8jP 1114159449 Received: from [192.168.0.8] (i-83-67-25-205.freedom2surf.net [83.67.25.205]) by www.fastmail.fm (Postfix) with ESMTP id B9C3B88; Fri, 22 Apr 2005 04:44:06 -0400 (EDT) In-Reply-To: <27013.1114149431@sss.pgh.pa.us> References: <20050421170018.2998.qmail@web51403.mail.yahoo.com> <27013.1114149431@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v622) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <869771629a1d24a91b8df779f7cddfe9@diroussel.xsmail.com> Content-Transfer-Encoding: 7bit Cc: Bill Chandler , pgsql-perform From: David Roussel Subject: Re: Index bloat problem? Date: Fri, 22 Apr 2005 09:44:05 +0100 To: Tom Lane X-Mailer: Apple Mail (2.622) 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: 200504/608 X-Sequence-Number: 12005 On 22 Apr 2005, at 06:57, Tom Lane wrote: > Bill Chandler writes: >> Client is reporting that the size of an index is >> greater than the number of rows in the table (1.9 >> million vs. 1.5 million). > > This thread seems to have wandered away without asking the critical > question "what did you mean by that?" > > It's not possible for an index to have more rows than there are in > the table unless something is seriously broken. And there aren't > any SQL operations that let you inspect an index directly anyway. > So: what is the actual observation that led you to the above > conclusion? Facts, please, not inferences. I work for the client in question. Glad you picked up on that point. I covered the detail in my my post "How can an index be larger than a table" on 21 Apr. 2005. I guess I was too detailed, and too much info put people off. http://archives.postgresql.org/pgsql-performance/2005-04/msg00553.php quoting from there... | |SELECT relname, relkind, reltuples, relpages FROM pg_class WHERE relname LIKE 'dave_data%'; | |relname relkind reltuples relpages |======================================= ======= ========= ======== |dave_data_update_events r 1593600.0 40209 |dave_data_update_events_event_id_key i 1912320.0 29271 |dave_data_update_events_event_id_seq S 1.0 1 |dave_data_update_events_lds_idx i 1593600.0 6139 |dave_data_update_events_obj_id_idx i 1593600.0 6139 |iso_pjm_data_update_events_obj_id_idx i 1593600.0 6139 | Note that there are only 1593600 rows in the table, so why the 1912320 figure? Of course I checked that the row count was correct... | |EXPLAIN ANALYZE |select count(*) from iso_pjm_data_update_events | |QUERY PLAN |Aggregate (cost=60129.00..60129.00 rows=1 width=0) (actual time=35933.292..35933.293 rows=1 loops=1) | -> Seq Scan on iso_pjm_data_update_events (cost=0.00..56145.00 rows=1593600 width=0) (actual time=0.213..27919.497 rows=1593600 loops=1) |Total runtime: 35933.489 ms | and... | |select count(*) from iso_pjm_data_update_events | |count |1593600 | so it's not that there are any undeleted rows lying around