how does the planer to estimate row when i use order by and group by

From: 楊新波 <silent0608(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: how does the planer to estimate row when i use order by and group by
Date: 2014-08-12 02:59:02
Message-ID: CAK=TrEEHgo9Lwk3O5MQqqjUTX=21-zTyNaeqKdhhXyhBsKqhLA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Mark Kirkwood 2014-08-12 04:56:10 Re: 60 core performance with 9.3
Previous Message Maxim Boguk 2014-08-09 04:22:00 Re: Optimization idea for long IN() lists