Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 02DE49FA19A for ; Fri, 9 Feb 2007 21:08:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 57777-05 for ; Fri, 9 Feb 2007 21:08:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.auptyma.com (mail.auptyma.com [64.60.124.12]) by postgresql.org (Postfix) with ESMTP id 8DBAE9FA197 for ; Fri, 9 Feb 2007 21:08:47 -0400 (AST) Received: from demo01 (mail.auptyma.com [64.60.124.12] (may be forged)) (authenticated bits=0) by mail.auptyma.com (8.13.1/8.13.1) with ESMTP id l1A0PuZZ028226 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Fri, 9 Feb 2007 16:25:56 -0800 Message-ID: <00c801c74cb0$04a27820$2900000a@demo01> From: "Virag Saksena" To: References: <00aa01c74ca6$7392a160$2900000a@demo01> <6478.1171068303@sss.pgh.pa.us> Subject: Re: Is there an equivalent for Oracle's user_tables.num_rows Date: Fri, 9 Feb 2007 17:08:47 -0800 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.7.5 (mail.auptyma.com [10.0.0.47]); Fri, 09 Feb 2007 16:25:56 -0800 (PST) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/111 X-Sequence-Number: 23165 Thanks, that is exactly what I was looking for I know that number of rows may not be the best indicator, but it is a heuristic that can be tracked easily, causing analyze for the first x insert events, and then only doing it only when an insert event causes total rows to exceed y % of the optimizer perceived rows Other more accurate heuristics like relative distribution of columns would be harder to track in the application, and I'd rather let the database do that by issuing the analyze Regards, Virag ----- Original Message ----- From: "Tom Lane" To: "Virag Saksena" Cc: Sent: Friday, February 09, 2007 4:45 PM Subject: Re: [PERFORM] Is there an equivalent for Oracle's user_tables.num_rows > "Virag Saksena" writes: >> Does someone know of a way of telling what the optimizer believes the = >> number of rows are ? > > You're looking in the wrong place; see pg_class.relpages and reltuples. > > But note that in recent releases neither one is taken as gospel. > Instead the planner uses the current physical table size in place of > relpages, and scales reltuples correspondingly. So neither steady > growth nor truncation create a need for re-ANALYZE; at least not as long > as the other statistics don't change too much. > > regards, tom lane >