Re: [HACKERS] Cardinality estimation for group by

2016-10-05 Thread Robert Haas
On Tue, Oct 4, 2016 at 8:05 AM, Chenxi Li 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

[HACKERS] Cardinality estimation for group by

2016-10-04 Thread Chenxi Li
Friends, How is cardinality estimation for "group by" is done and where is the code doing that? Best Regards, Chenxi Li

Re: [HACKERS] cardinality()

2009-03-01 Thread Grzegorz Jaskiewicz
On 1 Mar 2009, at 00:52, Andrew Dunstan wrote: We seem to have acquired a cardinality() function with almost no discussion, and it has semantics that are a bit surprising to me. I should have thought cardinality(array) would be the total number of elements in the array. Instead, it

Re: [HACKERS] cardinality()

2009-03-01 Thread Andrew Dunstan
Grzegorz Jaskiewicz wrote: On 1 Mar 2009, at 00:52, Andrew Dunstan wrote: We seem to have acquired a cardinality() function with almost no discussion, and it has semantics that are a bit surprising to me. I should have thought cardinality(array) would be the total number of elements in

Re: [HACKERS] cardinality()

2009-03-01 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: Grzegorz Jaskiewicz wrote: On 1 Mar 2009, at 00:52, Andrew Dunstan wrote: We seem to have acquired a cardinality() function with almost no discussion, and it has semantics that are a bit surprising to me. I should have thought cardinality(array)

Re: [HACKERS] cardinality()

2009-03-01 Thread Tom Lane
I wrote: The standard doesn't have multi-dimensional arrays, so it's entirely possible that somewhere in it there is wording that makes cardinality() equivalent to the length of the first dimension. But I concur with Andrew that this is flat wrong when extended to m-d arrays. I poked around

Re: [HACKERS] cardinality()

2009-03-01 Thread Pavel Stehule
2009/3/1 Tom Lane t...@sss.pgh.pa.us: I wrote: The standard doesn't have multi-dimensional arrays, so it's entirely possible that somewhere in it there is wording that makes cardinality() equivalent to the length of the first dimension.  But I concur with Andrew that this is flat wrong when

Re: [HACKERS] cardinality()

2009-03-01 Thread Stephan Szabo
On Sun, 1 Mar 2009, Tom Lane wrote: I wrote: The standard doesn't have multi-dimensional arrays, so it's entirely possible that somewhere in it there is wording that makes cardinality() equivalent to the length of the first dimension. But I concur with Andrew that this is flat wrong

Re: [HACKERS] cardinality()

2009-03-01 Thread Peter Eisentraut
On Sunday 01 March 2009 19:40:16 Tom Lane wrote: I wrote: The standard doesn't have multi-dimensional arrays, so it's entirely possible that somewhere in it there is wording that makes cardinality() equivalent to the length of the first dimension. But I concur with Andrew that this is

Re: [HACKERS] cardinality()

2009-03-01 Thread Gregory Stark
Peter Eisentraut pete...@gmx.net writes: The standard represents multidimensional arrays as arrays of arrays (like in C). Uh, C doesn't represent multidimensional arrays as arrays of arrays so you've lost me already. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com

Re: [HACKERS] cardinality()

2009-03-01 Thread Bruce Momjian
Gregory Stark wrote: Peter Eisentraut pete...@gmx.net writes: The standard represents multidimensional arrays as arrays of arrays (like in C). Uh, C doesn't represent multidimensional arrays as arrays of arrays so you've lost me already. I think he meant to say C _can_ represent

[HACKERS] cardinality()

2009-02-28 Thread Andrew Dunstan
We seem to have acquired a cardinality() function with almost no discussion, and it has semantics that are a bit surprising to me. I should have thought cardinality(array) would be the total number of elements in the array. Instead, it seems it is a synonym for array_length(array,1). Is that