Hi,
On 03/02/2016 05:17 PM, Thom Brown wrote:
...
> Well, firstly, the patches all apply.
>
> But I have a question (which is coming really late, but I'll ask it
> anyway). Is it intended that CREATE STATISTICS will only be for
> multivariate statistics? Or do you think we could add support for
> expression statistics in future too?
>
> e.g.
>
> CREATE STATISTICS stats_comment_length ON comments (length(comment));
Hmmm, that's not a use case I had in mind while working on the patch,
but it sounds interesting. I don't see why the syntax would not support
this - I'd like to add support for expressions into the multivariate
patch, but that will still require at least 2 columns to build
multivariate statistics. But perhaps it'd be possible to relax the "at
least 2 columns" requirement, and collect regular statistics somewhere.
So I don't see why the syntax could not work for that case too, but I'm
not going to work on that.
>
>
> I also note that the docs contain this:
>
> CREATE STATISTICS [ IF NOT EXISTS ] statistics_name ON table_name ( [
> { column_name } ] [, ...])
> [ WITH ( statistics_parameter [= value] [, ... ] )
>
> The open square bracket before WITH doesn't get closed. Also, it
> indicates that columns are entirely options, so () would be valid, but
> that's not the case. Also, a space is missing after the first
> ellipsis. So I think this should read:
>
> CREATE STATISTICS [ IF NOT EXISTS ] statistics_name ON table_name (
> { column_name } [, ... ])
> [ WITH ( statistics_parameter [= value] [, ... ] ) ]
Yeah, will fix.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services