Обсуждение: First patch -- somewhat trivial feature

Поиск
Список
Период
Сортировка

First patch -- somewhat trivial feature

От
Robert Berry
Дата:
This is my first attempt at writing a patch, so it's pretty simple.

Commit log sums it up:

Adds a convenience feature to the explain command which prints out GUC cost parameters in explain text output.
    
    For example:

    explain (params) select * from table;

    will include text output like the following:
    
    Cost Params:
             seq_page: 1.000000, rnd_page: 4.000000, cpu_tup: 0.010000, cpu_ind: 0.005000, cpu_op: 0.002500
             amenabled: 11111111111
    
    The bit vector is enable variables in the order listed in cost.h, though mainly provides a high level view on whether or not any strategies are disabled.

------

I recognize that this is kind of a frivolous feature which may not be worth any potential maintenance burden, so submitted for what it's worth as an initial effort.

Best Regards,
Robert




Вложения

Re: First patch -- somewhat trivial feature

От
Stephen Frost
Дата:
* Robert Berry (berrydigital@gmail.com) wrote:
> This is my first attempt at writing a patch, so it's pretty simple.

Neat!

>              seq_page: 1.000000, rnd_page: 4.000000, cpu_tup: 0.010000,
> cpu_ind: 0.005000, cpu_op: 0.002500
>              amenabled: 11111111111
>
>     The bit vector is enable variables in the order listed in cost.h,
> though mainly provides a high level view on whether or not any strategies
> are disabled.

While I like the general idea, I have to admit that I don't particularly
like the format and I'm not sure why it makes sense to have this as part
of 'explain'?  Why not do a 'show all;' ahead of the explain?

> I recognize that this is kind of a frivolous feature which may not be worth
> any potential maintenance burden, so submitted for what it's worth as an
> initial effort.

A bit more understanding about why you find it particularly useful (your
specific use-case for it) would be helpful.  Also, may I suggest that
you look at http://commitfest.postgresql.org as you'll be asked to post
any patches you wish to submit there for review and consideration.
Thanks!
    Stephen

Re: First patch -- somewhat trivial feature

От
David Johnston
Дата:
Stephen Frost wrote
> * Robert Berry (

> berrydigital@

> ) wrote:
>> This is my first attempt at writing a patch, so it's pretty simple.
> 
> Neat!
> 
>>              seq_page: 1.000000, rnd_page: 4.000000, cpu_tup: 0.010000,
>> cpu_ind: 0.005000, cpu_op: 0.002500
>>              amenabled: 11111111111
>> 
>>     The bit vector is enable variables in the order listed in cost.h,
>> though mainly provides a high level view on whether or not any strategies
>> are disabled.
> 
> While I like the general idea, I have to admit that I don't particularly
> like the format and I'm not sure why it makes sense to have this as part
> of 'explain'?  Why not do a 'show all;' ahead of the explain?

I kinda get the theory behind this but, WRT formatting, explain can output
multiple formats and any patch affecting said output should provide for
changing all of them.  Having each of the sample outputs in the post would
allow for comments from those who would not generally apply such patches.

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/First-patch-somewhat-trivial-feature-tp5778245p5778250.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.



Re: First patch -- somewhat trivial feature

От
Robert Berry
Дата:
Snowman --

Thanks for feedback.  I imagined this feature could be useful in a couple of contexts, though mainly in the sense of documenting query optimization efforts.

In one case you may be tweaking cost parameters and having a built in record of the parameters in the explain output can make that more reliable.

In a support context, it can help communicate all the details behind the selection of a query plan, perhaps on IRC support.

David J. --

I originally conceived the notion for the feature while off in the deep end thinking about automatic cost parameter selection.  

It seems plausible that the ideal theoretical costs would be influenced by server activity (io/cpu utilization) and various buffer states at a point in time.  This kind of optimization work is a little beyond my understanding and capability so this was a first step in thinking about this topic.  It turned into a trivial user text output feature, but implementing output formats that are more machine friendly still makes a lot of sense.

Best Regards,
-Robert  



On Wed, Nov 13, 2013 at 4:16 PM, David Johnston <polobo@yahoo.com> wrote:
Stephen Frost wrote
> * Robert Berry (

> berrydigital@

> ) wrote:
>> This is my first attempt at writing a patch, so it's pretty simple.
>
> Neat!
>
>>              seq_page: 1.000000, rnd_page: 4.000000, cpu_tup: 0.010000,
>> cpu_ind: 0.005000, cpu_op: 0.002500
>>              amenabled: 11111111111
>>
>>     The bit vector is enable variables in the order listed in cost.h,
>> though mainly provides a high level view on whether or not any strategies
>> are disabled.
>
> While I like the general idea, I have to admit that I don't particularly
> like the format and I'm not sure why it makes sense to have this as part
> of 'explain'?  Why not do a 'show all;' ahead of the explain?

I kinda get the theory behind this but, WRT formatting, explain can output
multiple formats and any patch affecting said output should provide for
changing all of them.  Having each of the sample outputs in the post would
allow for comments from those who would not generally apply such patches.

David J.




--
View this message in context: http://postgresql.1045698.n5.nabble.com/First-patch-somewhat-trivial-feature-tp5778245p5778250.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers