1
0
mirror of https://gitlab.com/depesz/explain.depesz.com.git synced 2025-07-17 01:42:34 +02:00

Display plan settings

This commit is contained in:
Hubert depesz Lubaczewski
2021-07-18 20:00:49 +02:00
parent 4b3c52d9e8
commit 0af9ea6170
4 changed files with 70 additions and 2 deletions

View File

@ -18,7 +18,7 @@ requires 'Encode';
requires 'English'; requires 'English';
requires 'File::Spec'; requires 'File::Spec';
requires 'Mojolicious'; requires 'Mojolicious';
requires 'Pg::Explain', '>= 1.11'; requires 'Pg::Explain', '>= 1.12';
requires 'Number::Bytes::Human'; requires 'Number::Bytes::Human';
# vim: set ft=perl: # vim: set ft=perl:

View File

@ -4,7 +4,7 @@
"secret" : "|Erp--Wjgb)+eiB/|H=|V7!#+M|L{a8=J2|pd+N1=M|&pJWq|M&,f3q^XS", "secret" : "|Erp--Wjgb)+eiB/|H=|V7!#+M|L{a8=J2|pd+N1=M|&pJWq|M&,f3q^XS",
"database" : { "database" : {
"dsn" : "dbi:Pg:database=depesz_explain;host=127.0.0.1;port=5140", "dsn" : "dbi:Pg:database=depesz_explain;host=127.0.0.1;port=5430",
"username" : "depesz_explain", "username" : "depesz_explain",
"options" : { "options" : {
"auto_commit" : 1, "auto_commit" : 1,

View File

@ -276,3 +276,12 @@ section p a:hover {background:#234;color:#fff;border:1px solid #123}
#jit-info tr.c-2 {background-color:#fe8 !important} #jit-info tr.c-2 {background-color:#fe8 !important}
#jit-info tr.c-3 {background-color:#e80 !important;color:#fff} #jit-info tr.c-3 {background-color:#e80 !important;color:#fff}
#jit-info tr.c-4 {background-color:#800 !important;color:#fff} #jit-info tr.c-4 {background-color:#800 !important;color:#fff}
#plan-settings {margin: 1em 0px;background: #eee;}
#plan-settings tbody a { border: 1px solid black; font-size: 0.5em; float: right; margin-left: 1em; padding: 0.3em; }
#plan-settings,
#plan-settings th,
#plan-settings td {border-collapse: collapse; border:1px solid #ccc;}
#plan-settings th { font-size: 1.2em; font-weight: bold; padding: 0.2em 0.5em;}
#plan-settings thead th {text-align: center; font-size: 1.5em;}
#plan-settings td {text-align: right; padding: 0.2em 0.5em;}

View File

@ -36,6 +36,44 @@
% 'Nested Loop Left Join' => 'http://www.depesz.com/2013/05/09/explaining-the-unexplainable-part-3/#join-modifiers', % 'Nested Loop Left Join' => 'http://www.depesz.com/2013/05/09/explaining-the-unexplainable-part-3/#join-modifiers',
% }; % };
% my $guc_docs = {
% 'constraint_exclusion' => 'query.html#GUC-CONSTRAINT-EXCLUSION',
% 'cpu_index_tuple_cost' => 'query.html#GUC-CPU-INDEX-TUPLE-COST',
% 'cpu_operator_cost' => 'query.html#GUC-CPU-OPERATOR-COST',
% 'cpu_tuple_cost' => 'query.html#GUC-CPU-TUPLE-COST',
% 'cursor_tuple_fraction' => 'query.html#GUC-CURSOR-TUPLE-FRACTION',
% 'effective_cache_size' => 'query.html#GUC-EFFECTIVE-CACHE-SIZE',
% 'effective_io_concurrency' => 'resource.html#GUC-EFFECTIVE-IO-CONCURRENCY',
% 'enable_bitmapscan' => 'query.html#GUC-ENABLE-BITMAPSCAN',
% 'enable_nestloop' => 'query.html#GUC-ENABLE-NESTLOOP',
% 'enable_partitionwise_aggregate' => 'query.html#GUC-ENABLE-PARTITIONWISE-AGGREGATE',
% 'enable_partitionwise_join' => 'query.html#GUC-ENABLE-PARTITIONWISE-JOIN',
% 'enable_seqscan' => 'query.html#GUC-ENABLE-SEQSCAN',
% 'force_parallel_mode' => 'developer.html#GUC-FORCE-PARALLEL-MODE',
% 'from_collapse_limit' => 'query.html#GUC-FROM-COLLAPSE-LIMIT',
% 'geqo_effort' => 'query.html#GUC-GEQO-EFFORT',
% 'geqo_threshold' => 'query.html#GUC-GEQO-THRESHOLD',
% 'hash_mem_multiplier' => 'resource.html#GUC-HASH-MEM-MULTIPLIER',
% 'jit' => 'query.html#GUC-JIT',
% 'jit_above_cost' => 'query.html#GUC-JIT-ABOVE-COST',
% 'jit_inline_above_cost' => 'query.html#GUC-JIT-INLINE-ABOVE-COST',
% 'jit_optimize_above_cost' => 'query.html#GUC-JIT-OPTIMIZE-ABOVE-COST',
% 'join_collapse_limit' => 'query.html#GUC-JOIN-COLLAPSE-LIMIT',
% 'maintenance_io_concurrency' => 'resource.html#GUC-MAINTENANCE-IO-CONCURRENCY',
% 'max_parallel_workers' => 'resource.html#GUC-MAX-PARALLEL-WORKERS',
% 'max_parallel_workers_per_gather' => 'resource.html#GUC-MAX-PARALLEL-WORKERS-PER-GATHER',
% 'min_parallel_index_scan_size' => 'query.html#GUC-MIN-PARALLEL-INDEX-SCAN-SIZE',
% 'min_parallel_table_scan_size' => 'query.html#GUC-MIN-PARALLEL-TABLE-SCAN-SIZE',
% 'parallel_setup_cost' => 'query.html#GUC-PARALLEL-SETUP-COST',
% 'parallel_tuple_cost' => 'query.html#GUC-PARALLEL-TUPLE-COST',
% 'plan_cache_mode' => 'query.html#GUC-PLAN-CACHE_MODE',
% 'random_page_cost' => 'query.html#GUC-RANDOM-PAGE-COST',
% 'search_path' => 'client.html#GUC-SEARCH-PATH',
% 'seq_page_cost' => 'query.html#GUC-SEQ-PAGE-COST',
% 'temp_buffers' => 'resource.html#GUC-TEMP-BUFFERS',
% 'work_mem' => 'resource.html#GUC-WORK-MEM',
% };
% my $id = stash( 'id' ); % my $id = stash( 'id' );
% my $title = stash( 'title' ); % my $title = stash( 'title' );
% my $full_title = $title ? "$id : $title" : $id; % my $full_title = $title ? "$id : $title" : $id;
@ -679,6 +717,27 @@
</table> </table>
% } % }
% if ( $explain->settings ) {
<table id="plan-settings">
<thead>
<tr><th colspan="3">Custom settings:</th></tr>
</thead>
<tbody>
% for my $name ( sort keys %{ $explain->settings }) {
<tr>
<th>
<%= $name %>
% if ( $guc_docs->{ $name }) {
<a href="https://www.postgresql.org/docs/current/runtime-config-<%= $guc_docs->{ $name } %>" target='_new'>?</a>
% }
</th>
<td><%= $explain->settings->{ $name } %></td>
</tr>
% }
</tbody>
</table>
% }
% if (defined $explain->jit) { % if (defined $explain->jit) {
% my $full_execution_time = $explain->runtime || 0; % my $full_execution_time = $explain->runtime || 0;
<table id="jit-info"> <table id="jit-info">