Release version 0.76

- Recognize properly parallel index scans and their table/index info
  Problem reported by Matthijs van der Vleuten
parent 26b1c3e1
Revision history for Pg-Explain
0.76 2018/02/05
- Recognize properly parallel index scans and their table/index info
Problem reported by Matthijs van der Vleuten
0.75 2017/11/29
- Change inclusive time calculation for parallel nodes to calculate
wall clock time, and not total time used.
......
......@@ -172,3 +172,6 @@ t/plans/24-expect
t/plans/24-plan
t/plans/25-expect
t/plans/25-plan
t/34-parallel-index-only-scan.t
t/33-parallel-index-scan.t
t/32-parallel-index-scan-backward.t
......@@ -4,7 +4,7 @@
"hubert depesz lubaczewski <depesz@depesz.com>"
],
"dynamic_config" : 1,
"generated_by" : "Module::Build version 0.4216",
"generated_by" : "Module::Build version 0.422",
"license" : [
"perl_5"
],
......@@ -42,35 +42,35 @@
"provides" : {
"Pg::Explain" : {
"file" : "lib/Pg/Explain.pm",
"version" : "0.75"
"version" : "0.76"
},
"Pg::Explain::From" : {
"file" : "lib/Pg/Explain/From.pm",
"version" : "0.75"
"version" : "0.76"
},
"Pg::Explain::FromJSON" : {
"file" : "lib/Pg/Explain/FromJSON.pm",
"version" : "0.75"
"version" : "0.76"
},
"Pg::Explain::FromText" : {
"file" : "lib/Pg/Explain/FromText.pm",
"version" : "0.75"
"version" : "0.76"
},
"Pg::Explain::FromXML" : {
"file" : "lib/Pg/Explain/FromXML.pm",
"version" : "0.75"
"version" : "0.76"
},
"Pg::Explain::FromYAML" : {
"file" : "lib/Pg/Explain/FromYAML.pm",
"version" : "0.75"
"version" : "0.76"
},
"Pg::Explain::Node" : {
"file" : "lib/Pg/Explain/Node.pm",
"version" : "0.75"
"version" : "0.76"
},
"Pg::Explain::StringAnonymizer" : {
"file" : "lib/Pg/Explain/StringAnonymizer.pm",
"version" : "0.75"
"version" : "0.76"
}
},
"release_status" : "stable",
......@@ -79,6 +79,6 @@
"http://dev.perl.org/licenses/"
]
},
"version" : "0.75",
"x_serialization_backend" : "JSON::PP version 2.27300"
"version" : "0.76",
"x_serialization_backend" : "JSON::PP version 2.27300_01"
}
......@@ -10,7 +10,7 @@ build_requires:
configure_requires:
Module::Build: '0.38'
dynamic_config: 1
generated_by: 'Module::Build version 0.4216, CPAN::Meta::Converter version 2.150005'
generated_by: 'Module::Build version 0.422, CPAN::Meta::Converter version 2.150005'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
......@@ -19,28 +19,28 @@ name: Pg-Explain
provides:
Pg::Explain:
file: lib/Pg/Explain.pm
version: '0.75'
version: '0.76'
Pg::Explain::From:
file: lib/Pg/Explain/From.pm
version: '0.75'
version: '0.76'
Pg::Explain::FromJSON:
file: lib/Pg/Explain/FromJSON.pm
version: '0.75'
version: '0.76'
Pg::Explain::FromText:
file: lib/Pg/Explain/FromText.pm
version: '0.75'
version: '0.76'
Pg::Explain::FromXML:
file: lib/Pg/Explain/FromXML.pm
version: '0.75'
version: '0.76'
Pg::Explain::FromYAML:
file: lib/Pg/Explain/FromYAML.pm
version: '0.75'
version: '0.76'
Pg::Explain::Node:
file: lib/Pg/Explain/Node.pm
version: '0.75'
version: '0.76'
Pg::Explain::StringAnonymizer:
file: lib/Pg/Explain/StringAnonymizer.pm
version: '0.75'
version: '0.76'
requires:
Clone: '0'
Digest::SHA: '0'
......@@ -51,5 +51,5 @@ requires:
perl: '5.010'
resources:
license: http://dev.perl.org/licenses/
version: '0.75'
version: '0.76'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
......@@ -11,11 +11,11 @@ Pg::Explain - Object approach at reading explain analyze output
=head1 VERSION
Version 0.75
Version 0.76
=cut
our $VERSION = '0.75';
our $VERSION = '0.76';
=head1 SYNOPSIS
......
......@@ -9,11 +9,11 @@ Pg::Explain::From - Base class for parsers of non-text explain formats.
=head1 VERSION
Version 0.75
Version 0.76
=cut
our $VERSION = '0.75';
our $VERSION = '0.76';
=head1 SYNOPSIS
......
......@@ -10,11 +10,11 @@ Pg::Explain::FromJSON - Parser for explains in JSON format
=head1 VERSION
Version 0.75
Version 0.76
=cut
our $VERSION = '0.75';
our $VERSION = '0.76';
=head1 SYNOPSIS
......
......@@ -9,11 +9,11 @@ Pg::Explain::FromText - Parser for text based explains
=head1 VERSION
Version 0.75
Version 0.76
=cut
our $VERSION = '0.75';
our $VERSION = '0.76';
=head1 SYNOPSIS
......
......@@ -10,11 +10,11 @@ Pg::Explain::FromXML - Parser for explains in XML format
=head1 VERSION
Version 0.75
Version 0.76
=cut
our $VERSION = '0.75';
our $VERSION = '0.76';
=head1 SYNOPSIS
......
......@@ -10,11 +10,11 @@ Pg::Explain::FromYAML - Parser for explains in YAML format
=head1 VERSION
Version 0.75
Version 0.76
=cut
our $VERSION = '0.75';
our $VERSION = '0.76';
=head1 SYNOPSIS
......
......@@ -12,11 +12,11 @@ Pg::Explain::Node - Class representing single node from query plan
=head1 VERSION
Version 0.75
Version 0.76
=cut
our $VERSION = '0.75';
our $VERSION = '0.76';
=head1 SYNOPSIS
......@@ -221,7 +221,7 @@ sub new {
$self->type( $1 );
$self->scan_on( { 'index_name' => $2, } );
}
elsif ( $self->type =~ m{ \A (Index (?: \s Only )? \s Scan (?: \s Backward )? ) \s using \s (\S+) \s on \s (\S+) (?: \s+ (\S+) ) ? \z }xms ) {
elsif ( $self->type =~ m{ \A ( (?: Parallel \s+ )? Index (?: \s Only )? \s Scan (?: \s Backward )? ) \s using \s (\S+) \s on \s (\S+) (?: \s+ (\S+) ) ? \z }xms ) {
$self->type( $1 );
$self->scan_on(
{
......
......@@ -11,11 +11,11 @@ Pg::Explain::StringAnonymizer - Class to anonymize sets of strings
=head1 VERSION
Version 0.75
Version 0.76
=cut
our $VERSION = '0.75';
our $VERSION = '0.76';
=head1 SYNOPSIS
......
#!perl
use Test::More;
use Test::Deep;
use Test::Exception;
use Data::Dumper;
use autodie;
use Pg::Explain;
plan 'tests' => 8;
my $explain = Pg::Explain->new(
'source' => q{
Limit (cost=1000.94..61706.58 rows=10 width=69) (actual time=2000.444..2000.447 rows=10 loops=1)
-> Gather Merge (cost=1000.94..595916.19 rows=98 width=69) (actual time=2000.443..2000.445 rows=10 loops=1)
Workers Planned: 5
Workers Launched: 5
-> Nested Loop Left Join (cost=0.86..594904.31 rows=20 width=69) (actual time=1972.282..1987.046 rows=10 loops=6)
Filter: ((base_video.channel_id = 20967) OR (base_video_keywords.keywords_id = 137204))
Rows Removed by Filter: 776866
-> Parallel Index Scan Backward using base_video_pkey on base_video (cost=0.43..219239.67 rows=456295 width=73) (actual time=0.160..344.535 rows=380246 loops=6)
-> Index Scan using base_video_keywords_video_id_52f035d6 on base_video_keywords (cost=0.43..0.66 rows=11 width=8) (actual time=0.003..0.004 rows=2 loops=2281476)
Index Cond: (base_video.id = video_id)
Planning time: 0.621 ms
Execution time: 2003.022 ms
}
);
isa_ok( $explain, 'Pg::Explain' );
isa_ok( $explain->top_node, 'Pg::Explain::Node' );
is( $explain->top_node->type, 'Limit', 'Properly extracted top node type' );
is( $explain->top_node->sub_nodes->[ 0 ]->type, 'Gather Merge', 'Properly extracted subnode-1' );
is( $explain->top_node->sub_nodes->[ 0 ]->sub_nodes->[ 0 ]->type, 'Nested Loop Left Join', 'Properly extracted subnode-2' );
my $parallel = $explain->top_node->sub_nodes->[ 0 ]->sub_nodes->[ 0 ]->sub_nodes->[ 0 ];
is( $parallel->type, 'Parallel Index Scan Backward', 'Properly parallel node' );
is( $parallel->scan_on->{ 'index_name' }, 'base_video_pkey', 'Properly extracted index used for parallel node' );
is( $parallel->scan_on->{ 'table_name' }, 'base_video', 'Properly extracted table used for parallel node' );
exit;
#!perl
use Test::More;
use Test::Deep;
use Test::Exception;
use Data::Dumper;
use autodie;
use Pg::Explain;
plan 'tests' => 8;
my $explain = Pg::Explain->new(
'source' => q{
GroupAggregate (cost=1002.57..31309179.09 rows=115381975 width=154)
Group Key: mac, freq, (ceil((heading / '60'::double precision))), (ceil((st_x(geom) / '60'::double precision))), (ceil((st_y(geom) / '60'::double precision)))
-> Incremental Sort (cost=1002.57..21790166.15 rows=115381975 width=98)
Sort Key: mac, freq, (ceil((heading / '60'::double precision))), (ceil((st_x(geom) / '60'::double precision))), (ceil((st_y(geom) / '60'::double precision)))
Presorted Key: mac, freq
-> Gather Merge (cost=1000.74..17575025.65 rows=115381975 width=98)
Workers Planned: 9
-> Parallel Index Scan using wifi_seen_mac_freq_idx on wifi_seen (cost=0.57..11849967.18 rows=12820219 width=74)
Filter: ((accuracy < '30'::double precision) AND ((speed * abs((ts - pos_ts))) < '30'::double precision))
}
);
isa_ok( $explain, 'Pg::Explain' );
isa_ok( $explain->top_node, 'Pg::Explain::Node' );
is( $explain->top_node->type, 'GroupAggregate', 'Properly extracted top node type' );
is( $explain->top_node->sub_nodes->[ 0 ]->type, 'Incremental Sort', 'Properly extracted subnode-1' );
is( $explain->top_node->sub_nodes->[ 0 ]->sub_nodes->[ 0 ]->type, 'Gather Merge', 'Properly extracted subnode-2' );
my $parallel = $explain->top_node->sub_nodes->[ 0 ]->sub_nodes->[ 0 ]->sub_nodes->[ 0 ];
is( $parallel->type, 'Parallel Index Scan', 'Properly parallel node' );
is( $parallel->scan_on->{ 'index_name' }, 'wifi_seen_mac_freq_idx', 'Properly extracted index used for parallel node' );
is( $parallel->scan_on->{ 'table_name' }, 'wifi_seen', 'Properly extracted table used for parallel node' );
exit;
#!perl
use Test::More;
use Test::Deep;
use Test::Exception;
use Data::Dumper;
use autodie;
use Pg::Explain;
plan 'tests' => 8;
my $explain = Pg::Explain->new(
'source' => q{
Finalize Aggregate (cost=23067.12..23067.13 rows=1 width=8) (actual time=85.738..85.738 rows=1 loops=1)
-> Gather (cost=23066.90..23067.11 rows=2 width=8) (actual time=85.720..85.734 rows=3 loops=1)
Workers Planned: 2
Workers Launched: 2
-> Partial Aggregate (cost=22066.90..22066.91 rows=1 width=8) (actual time=81.301..81.301 rows=1 loops=3)
-> Parallel Index Only Scan using ix_time_performance_dayofweek_btree on time_performance (cost=0.42..20982.16 rows=433897 width=0) (actual time=0.046..48.860 rows=347145 loops=3)
Heap Fetches: 0
Planning time: 0.113 ms
Execution time: 87.672 ms
(9 rows)
}
);
isa_ok( $explain, 'Pg::Explain' );
isa_ok( $explain->top_node, 'Pg::Explain::Node' );
is( $explain->top_node->type , 'Finalize Aggregate' , 'Properly extracted top node type' );
is( $explain->top_node->sub_nodes->[ 0 ]->type , 'Gather' , 'Properly extracted subnode-1' );
is( $explain->top_node->sub_nodes->[ 0 ]->sub_nodes->[ 0 ]->type , 'Partial Aggregate' , 'Properly extracted subnode-1' );
my $parallel = $explain->top_node->sub_nodes->[ 0 ]->sub_nodes->[ 0 ]->sub_nodes->[ 0 ];
is( $parallel->type, 'Parallel Index Only Scan', 'Properly parallel node' );
is( $parallel->scan_on->{ 'index_name' }, 'ix_time_performance_dayofweek_btree', 'Properly extracted index used for parallel node' );
is( $parallel->scan_on->{ 'table_name' }, 'time_performance', 'Properly extracted table used for parallel node' );
exit;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment