Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 06E8B9FA197 for ; Fri, 9 Feb 2007 21:09:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 57389-07 for ; Fri, 9 Feb 2007 21:09:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail01.enterprisedb.com (mail01.enterprisedb.com [63.246.7.168]) by postgresql.org (Postfix) with ESMTP id 4B4D39FA3DA for ; Fri, 9 Feb 2007 21:09:11 -0400 (AST) thread-index: AcdMsBfNaFIq1aa9SeuRKS3m8CplIg== Received: from [192.168.0.22] ([84.12.155.249]) by mail01.enterprisedb.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 9 Feb 2007 20:09:19 -0500 Subject: Re: Is there an equivalent for Oracle'suser_tables.num_rows Content-Class: urn:content-classes:message Importance: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2826 From: "Simon Riggs" To: "Tom Lane" Cc: "Virag Saksena" , In-reply-to: <6478.1171068303@sss.pgh.pa.us> References: <00aa01c74ca6$7392a160$2900000a@demo01> <6478.1171068303@sss.pgh.pa.us> Content-Type: text/plain; charset="iso-8859-1" Date: Sat, 10 Feb 2007 01:06:37 +0000 Message-ID: <1171069598.25938.151.camel@silverbirch.site> MIME-Version: 1.0 X-Mailer: Evolution 2.6.0 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 10 Feb 2007 01:09:19.0718 (UTC) FILETIME=[17989860:01C74CB0] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/112 X-Sequence-Number: 23166 On Fri, 2007-02-09 at 19:45 -0500, Tom Lane wrote: > "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. That does work very well for Production systems, but not for Development. In 8.4, I'll be looking for a way to export Production system stats to a Dev server that *acts* as if it really had 10^lots rows in it. That will also help us support the optimiser when it is acting in extreme conditions that are not sensibly reproducible in reality by hackers. It will also provide us with what-if capability for system expansion. -- Simon Riggs EnterpriseDB http://www.enterprisedb.com