X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BAFC7476315 for ; Sun, 20 Apr 2003 11:25:25 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 1D83A475FEE for ; Sun, 20 Apr 2003 11:25:25 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h3KFPTU6027005; Sun, 20 Apr 2003 11:25:29 -0400 (EDT) To: Andreas Pflug Cc: pgsql-performance@postgresql.org Subject: Re: [SQL] Yet Another (Simple) Case of Index not used In-reply-to: <3EA27179.6010307@web.de> References: <200304090918.45275.josh@agliodbs.com> <20030419130146.GI1847@filer> <21955.1050767928@sss.pgh.pa.us> <20030420011336.GJ1847@filer> <24735.1050809664@sss.pgh.pa.us> <20030420062852.GK1847@filer> <3EA27179.6010307@web.de> Comments: In-reply-to Andreas Pflug message dated "Sun, 20 Apr 2003 12:07:53 +0200" Date: Sun, 20 Apr 2003 11:25:29 -0400 Message-ID: <27004.1050852329@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-32.3 required=5.0 tests=BAYES_00,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/179 X-Sequence-Number: 1685 Andreas Pflug writes: > I think a row counter on each table would be even useful for some kind > of auto-vacuum mechanism, that could be triggered if pg_class.reltuples > deviates too far from the real row count. It would be counting the wrong thing. auto-vacuum needs to know how many dead tuples are in a table, not how many live ones. Example: UPDATE doesn't change the live-tuple count (without this property, I don't think the sort of count maintenance Kevin is proposing could possibly be efficient enough to be interesting). But it does create a dead tuple that vacuum wants to know about. regards, tom lane