From bb7242c0fe454a6eba46c24e99f03c1ac31b336d Mon Sep 17 00:00:00 2001 From: Hubert depesz Lubaczewski Date: Sat, 25 May 2013 00:36:52 +0200 Subject: [PATCH 1/2] Fix display of Index Only Scans New Pg::Explain version (0.67) splits them into parts, so it has to be re-assembled for display --- templates/controller/show.html.ep | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/controller/show.html.ep b/templates/controller/show.html.ep index b98bf97..9210d4e 100755 --- a/templates/controller/show.html.ep +++ b/templates/controller/show.html.ep @@ -160,6 +160,12 @@ % elsif ( 'Index Scan Backward' eq $node->type ) { using <%= $node->scan_on->{ index_name } %> on <%= $node->scan_on->{ table_name } %> <%= $node->scan_on->{ table_alias } || '' %> % } + % elsif ( 'Index Only Scan' eq $node->type ) { + using <%= $node->scan_on->{ index_name } %> on <%= $node->scan_on->{ table_name } %> <%= $node->scan_on->{ table_alias } || '' %> + % } + % elsif ( 'Index Only Scan Backward' eq $node->type ) { + using <%= $node->scan_on->{ index_name } %> on <%= $node->scan_on->{ table_name } %> <%= $node->scan_on->{ table_alias } || '' %> + % } % elsif ( 'Seq Scan' eq $node->type ) { on <%= $node->scan_on->{ table_name } %> <%= $node->scan_on->{ table_alias } || '' %> % } From a8150c049467cea99970c92de18d59e58b29c5d8 Mon Sep 17 00:00:00 2001 From: Hubert depesz Lubaczewski Date: Tue, 8 Oct 2013 15:16:48 +0200 Subject: [PATCH 2/2] Fix display of writing nodes from older Pgs Older Pgs (9.0 for example) didn't show table name for insert/update/delete. Fix template not to assume "scan_on" is available for writing nodes. --- templates/controller/show.html.ep | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/controller/show.html.ep b/templates/controller/show.html.ep index 9210d4e..386e945 100755 --- a/templates/controller/show.html.ep +++ b/templates/controller/show.html.ep @@ -169,13 +169,13 @@ % elsif ( 'Seq Scan' eq $node->type ) { on <%= $node->scan_on->{ table_name } %> <%= $node->scan_on->{ table_alias } || '' %> % } - % elsif ( 'Insert' eq $node->type ) { + % elsif ( ( 'Insert' eq $node->type ) && ( $node->scan_on ) ) { on <%= $node->scan_on->{ table_name } %> <%= $node->scan_on->{ table_alias } || '' %> % } - % elsif ( 'Update' eq $node->type ) { + % elsif ( ( 'Update' eq $node->type ) && ( $node->scan_on ) ) { on <%= $node->scan_on->{ table_name } %> <%= $node->scan_on->{ table_alias } || '' %> % } - % elsif ( 'Delete' eq $node->type ) { + % elsif ( ( 'Delete' eq $node->type ) && ( $node->scan_on ) ) { on <%= $node->scan_on->{ table_name } %> <%= $node->scan_on->{ table_alias } || '' %> % } % elsif ( 'Foreign Scan' eq $node->type ) {