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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux