2011-03-10 15:19:34 +00:00
% layout 'default';
% my $title = 'New explain';
2017-05-19 18:45:41 +02:00
% $title = 'New optimization for plan #' . stash('original_plan_id') if stash('optimization');
2011-03-10 15:19:34 +00:00
% title $title;
<h1><%= $title =%></h1>
2011-05-04 07:12:41 +00:00
% if ( stash( 'message' ) ) {
2011-06-14 14:33:05 +02:00
<div class="message">
2011-05-04 07:12:41 +00:00
<p class="message"><%= stash( 'message' ) =%></p>
2019-12-17 20:09:28 +01:00
% if ( stash( 'details' ) ) {
<p class="details"><%= stash( 'details' ) =%></p>
% }
2011-06-14 14:33:05 +02:00
<p class="hint">You might want to <a href="<%= url_for 'contact' %>">contact</a> me if you think that the problem is on <a href="http://explain.depesz.com/">explain.depesz.com</a> side.</p>
</div>
2011-05-04 07:12:41 +00:00
% }
2013-03-30 20:18:27 +01:00
% if ( flash( 'message' ) ) {
<div class="message">
<p class="message"><%= flash( 'message' ) =%></p>
</div>
% }
2017-05-19 18:45:41 +02:00
<form id="new-explain" method="post" action="<%= url_for 'new-explain' %>">
2011-03-11 06:19:50 +00:00
<div class="fe fe-first fe_plan">
2011-06-28 15:25:14 +02:00
<label for="title">Optional title for plan:</label>
2017-05-19 18:45:41 +02:00
% if ( stash('optimization') ) {
% my $new_title = "Optimization for: ";
% $new_title .= stash('original_title') . ";" if stash('original_title');
% $new_title .= " plan #" . stash('original_plan_id');
<input id="title" name="title" value="<%= $new_title %>"/>
<input id="optimization_for" name="optimization_for" type="hidden" value="<%= stash('original_plan_id') %>"/>
% } else {
2011-06-28 15:25:14 +02:00
<input id="title" name="title" class="auto-hint" title="Optional title"/>
2017-05-19 18:45:41 +02:00
% }
2022-11-12 10:27:49 +01:00
<label for="plan">Paste output of <code><a href="https://www.postgresql.org/docs/current/sql-explain.html">EXPLAIN (ANALYZE, BUFFERS, ...)</a> <em>your query</em>;</code> here:</label>
2011-06-14 14:04:11 +02:00
<textarea id="plan" name="plan" class="auto-hint" title="For example:
2022-08-23 12:04:57 +02:00
=> EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM some_view WHERE nspname not in ('pg_catalog', 'information_schema') order by 1, 2, 3;
2011-06-14 14:04:11 +02:00
QUERY PLAN
2022-08-23 12:04:57 +02:00
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Sort (cost=291.79..293.15 rows=544 width=224) (actual time=60.754..60.760 rows=69 loops=1)
2011-06-14 14:04:11 +02:00
Sort Key: n.nspname, p.proname, (pg_get_function_arguments(p.oid))
2022-08-23 12:04:57 +02:00
Sort Method: quicksort Memory: 38kB
Buffers: shared hit=97
-> Hash Join (cost=1.08..223.93 rows=544 width=224) (actual time=11.679..60.696 rows=69 loops=1)
2011-06-14 14:04:11 +02:00
Hash Cond: (p.pronamespace = n.oid)
2022-08-23 12:04:57 +02:00
Buffers: shared hit=97
-> Seq Scan on pg_proc p (cost=0.00..210.17 rows=1087 width=73) (actual time=0.067..59.669 rows=3320 loops=1)
2011-06-14 14:04:11 +02:00
Filter: pg_function_is_visible(oid)
2022-08-23 12:04:57 +02:00
Rows Removed by Filter: 12
Buffers: shared hit=96
-> Hash (cost=1.06..1.06 rows=2 width=68) (actual time=0.011..0.011 rows=2 loops=1)
Buckets: 1024 Batches: 1 Memory Usage: 9kB
Buffers: shared hit=1
-> Seq Scan on pg_namespace n (cost=0.00..1.06 rows=2 width=68) (actual time=0.004..0.006 rows=2 loops=1)
Filter: ((nspname <> 'pg_catalog'::name) AND (nspname <> 'information_schema'::name))
Rows Removed by Filter: 2
Buffers: shared hit=1
Planning:
Buffers: shared hit=4
Planning Time: 0.288 ms
Execution Time: 60.802 ms
(22 rows)"></textarea>
2020-07-27 15:16:43 +02:00
<label for="query">Optionally paste your query here:</label>
<textarea id="query" name="query" class="auto-hint" title="For example:
SELECT a, b
FROM c
WHERE d > now() - '5 minutes'::interval;"></textarea>
2023-03-27 15:42:58 +02:00
<label for="comments">Optionally add some comments (such as table definitions) here:</label>
<textarea id="comments" name="comments" class="auto-hint" title="For example:
$ \d pg_proc
Table "pg_catalog.pg_proc"
Column │ Type │ Collation │ Nullable │ Default
─────────────────┼──────────────┼───────────┼──────────┼─────────
oid │ oid │ │ not null │
proname │ name │ │ not null │
pronamespace │ oid │ │ not null │
proowner │ oid │ │ not null │
prolang │ oid │ │ not null │
procost │ real │ │ not null │
prorows │ real │ │ not null │
provariadic │ oid │ │ not null │
prosupport │ regproc │ │ not null │
prokind │ "char" │ │ not null │
prosecdef │ boolean │ │ not null │
proleakproof │ boolean │ │ not null │
proisstrict │ boolean │ │ not null │
proretset │ boolean │ │ not null │
provolatile │ "char" │ │ not null │
proparallel │ "char" │ │ not null │
pronargs │ smallint │ │ not null │
pronargdefaults │ smallint │ │ not null │
prorettype │ oid │ │ not null │
proargtypes │ oidvector │ │ not null │
proallargtypes │ oid[] │ │ │
proargmodes │ "char"[] │ │ │
proargnames │ text[] │ C │ │
proargdefaults │ pg_node_tree │ C │ │
protrftypes │ oid[] │ │ │
prosrc │ text │ C │ not null │
probin │ text │ C │ │
prosqlbody │ pg_node_tree │ C │ │
proconfig │ text[] │ C │ │
proacl │ aclitem[] │ │ │
Indexes:
"pg_proc_oid_index" PRIMARY KEY, btree (oid)
"pg_proc_proname_args_nsp_index" UNIQUE CONSTRAINT, btree (proname, proargtypes, pronamespace)
"></textarea>
2022-11-12 12:08:52 +01:00
2011-03-10 15:19:34 +00:00
</div>
2011-03-11 06:19:50 +00:00
<div class="fe fe_is_public">
2017-06-13 20:33:27 +02:00
<label for="is_public">I want this plan to be visible on the <a href="<%= url_for 'history' %>" title="link to: history">history</a> page.</label>
2011-03-11 06:19:50 +00:00
<input type="checkbox" class="checkbox" id="is_public" name="is_public" value="1" checked="checked" />
2011-03-10 15:19:34 +00:00
</div>
2011-06-11 04:44:41 +02:00
<div class="fe fe_is_anon">
2020-11-24 16:48:25 +01:00
<label for="is_anon">I want this plan to be <a href="http://www.depesz.com/index.php/2011/06/11/explain-depesz-com-new-feature-and-some-new-stats/" title="link to: anonymization description">obfuscated</a> before saving. (Note that this makes plans much harder to understand for others, so use only when absolutely necessary.)</label>
2011-06-11 04:44:41 +02:00
<input type="checkbox" class="checkbox" id="is_anon" name="is_anon" value="1"/>
</div>
2011-03-11 06:19:50 +00:00
<div class="fe fe-last fe-buttons">
2011-03-10 15:19:34 +00:00
<button type="submit" name="submit_plan" id="submit_plan"><span>Submit</span></button>
</div>
</form>