Re: Multi-column distinctness.

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема Re: Multi-column distinctness.
Дата
Msg-id 5626A894.3010908@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: Multi-column distinctness.  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Multi-column distinctness.  (Simon Riggs <simon@2ndQuadrant.com>)
Список pgsql-hackers
Hi,

On 10/20/2015 09:11 PM, Tom Lane wrote:
> I wrote:
>> Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
>>> The problem is that the actual syntax is ADD [COLUMN], so we
>>> can't simply use ADD STATISTICS as that would mean a conflict in
>>> the grammar. Resolving it means either making COLUMN
>>> non-optional, or adding STATISTICS to reserved keywords - both
>>> options break existing code.
>
>> I'm unconvinced that it cannot be made to work.
>
> Specifically, this works just fine for me as a variant of
> alter_table_cmd:
>
>             | ADD_P STATISTICS ON '(' name_list ')'
>
> and I can get this to work too
>
>             | DROP STATISTICS ON '(' name_list ')'
>
> if I expand out the "DROP opt_column" productions to be two separate
> productions with and without COLUMN, as was done long ago for ADD
> COLUMN.
>
> These also work without ON, actually, though it does not work to
> leave out the parens. (I think that has to do with the conflict
> against multiple ALTER TABLE subcommands, not against ADD COLUMN.)
>
> It doesn't look like we could easily stick a "name" in between
> STATISTICS and ON, but I'm unconvinced that that's necessary.

Well, it's definitely easier to reference the statistics by name (e.g. 
in the DROP command).

> Can't we just insist that there be only one statistics declaration
> for a given column list?

I would rather not, because I envision preferring different types of 
statistics for different types of queries. For example the statistics 
discussed in this particular thread only supports equality clauses, so 
this restriction would mean we can't also define histogram, we'll be 
unable to estimate queries with ranges.

regards

--
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: [PATCH] SQL function to report log message
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Multi-column distinctness.