pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Lee Wu <Lwu@mxlogic.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: rows in explain
Date: Fri, 29 Jul 2005 12:45:15 -0600
Message-ID: <20050729184515.GA98486@winnie.fuhr.org> (raw)
In-Reply-To: <E1F0E4D89D8FA44789DFC065C8E755281A36B6@mxlhq-exch01.corp.mxlogic.com>
References: <E1F0E4D89D8FA44789DFC065C8E755281A36B6@mxlhq-exch01.corp.mxlogic.com>

On Fri, Jul 29, 2005 at 11:54:18AM -0600, Lee Wu wrote:
> explain select count(*) from pg_class where relname='pg_class';
>                           QUERY PLAN
> --------------------------------------------------------------
>  Aggregate  (cost=4.55..4.55 rows=1 width=0)
>    ->  Seq Scan on pg_class  (cost=0.00..4.55 rows=1 width=0)
>          Filter: (relname = 'pg_class'::name)
> (3 rows)
> 
> Where and how PG get "rows=1"?

The planner uses statistics to estimate the number of rows that a
query will return.  Here are a couple of links that provide more
information:

http://www.postgresql.org/docs/8.0/static/planner-stats.html
http://www.postgresql.org/docs/8.0/static/view-pg-stats.html
http://www.postgresql.org/docs/8.0/static/sql-analyze.html
http://developer.postgresql.org/docs/postgres/planner-stats-details.html

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



view thread (3+ messages)  latest in thread

Message-ID: <20050729184515.GA98486@winnie.fuhr.org>
Permalink:  ../20050729184515.GA98486@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20050729184515.GA98486@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mike@fuhr.org, Lwu@mxlogic.com
  Subject: Re: rows in explain
  In-Reply-To: <20050729184515.GA98486@winnie.fuhr.org>
  References: <E1F0E4D89D8FA44789DFC065C8E755281A36B6@mxlhq-exch01.corp.mxlogic.com> <20050729184515.GA98486@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox