| From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
|---|---|
| To: | Chenxi Li <spiritlcx(at)gmail(dot)com> |
| Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Cardinality estimation for group by |
| Date: | 2016-10-05 17:22:13 |
| Message-ID: | CA+Tgmob0AV7Z37s5srqyOTaFXAgM8LwjWZn_Eud59hp4oKs2wQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Oct 4, 2016 at 8:05 AM, Chenxi Li <spiritlcx(at)gmail(dot)com> wrote:
> How is cardinality estimation for "group by" is done and where is the code
> doing that?
I would suggest that you start by looking at estimate_num_groups() in
src/backend/utils/adt/selfuncs.c. You might also want to look at
cost_agg() in src/backend/optimizer/path/costsize.c, and also the
places where it gets called. They don't all estimate the number of
groups in the same way.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2016-10-05 18:01:05 | Our "fallback" atomics implementation doesn't actually work |
| Previous Message | Robert Haas | 2016-10-05 17:16:11 | Re: asynchronous execution |