how does the planer to estimate row when i use order by and group by - Mailing list pgsql-performance

From 楊新波
Subject how does the planer to estimate row when i use order by and group by
Date
Msg-id CAK=TrEEHgo9Lwk3O5MQqqjUTX=21-zTyNaeqKdhhXyhBsKqhLA@mail.gmail.com
Whole thread Raw
Responses Re: how does the planer to estimate row when i use order by and group by  (Marti Raudsepp <marti@juffo.org>)
List pgsql-performance
hi ,everybody

why does the planer estimate 200 rows when i use order by and group by .
evn:postgresql 8.4 and 9.3

table:
CREATE TABLE a
(
  id serial NOT NULL,
  name character varying(20),
  modifytime timestamp without time zone,
  CONSTRAINT a_pk PRIMARY KEY (id)
)

SQL:
explain  analyze
select * from 
( select id from a order by id ) d 
group by  id;

Query plan:
"Group  (cost=0.15..66.42 rows=200 width=4) (actual time=0.008..0.008 rows=0 loops=1)"
"  ->  Index Only Scan using a_pk on a  (cost=0.15..56.30 rows=810 width=4) (actual time=0.006..0.006 rows=0 loops=1)"
"        Heap Fetches: 0"
"Total runtime: 0.046 ms"

Can anybody suggest something or explain this behavior?

pgsql-performance by date:

Previous
From: Maxim Boguk
Date:
Subject: Re: Optimization idea for long IN() lists
Next
From: Mark Kirkwood
Date:
Subject: Re: 60 core performance with 9.3