DBIx::Class::Helper::ResultSet::Explain(3pm)

DBIx::Class::Helper::ResultSet::Explain3pm

Get query plan for a resultset

Usage

This module mostly makes sense to be used without setting as a component:

 use Devel::Dwarn;
 Dwarn DBIx::Class::ResultSet::Explain::explain($rs)

But as usual, if you prefer to use it as a component here's how:

 package MyApp::Schema::ResultSet::Foo;
 __PACKAGE__->load_components(qw{Helper::ResultSet::Explain});
 ...
 1;

And then in a script or something:

 use Devel::Dwarn;
 Dwarn $rs->explain;

Overview

This is just a handy little tool that gives you the query plan for a given ResultSet. The output is in no way normalized, so just treat it as a debug tool or something. The only supported DB's are those listed below. Have fun!

See "NOTE" in DBIx::Class::Helper::ResultSet for a nice way to apply it to your entire schema.

EXAMPLE OUTPUT FROM SUPPORTED DB's

SQlite

 [
   [
     0,
     "Init",
     0,
     10,
     0,
     undef,
     0,
     undef,
   ],
   [
     1,
     "OpenRead",
     0,
     3,
     0,
     4,
     0,
     undef,
   ],
   [
     2,
     "Rewind",
     0,
     9,
     0,
     undef,
     0,
     undef,
   ],
   [
     3,
     "Rowid",
     0,
     1,
     0,
     undef,
     0,
     undef,
   ],
   [
     4,
     "Column",
     0,
     1,
     2,
     undef,
     0,
     undef,
   ],
   [
     5,
     "Column",
     0,
     2,
     3,
     undef,
     0,
     undef,
   ],
   [
     6,
     "Column",
     0,
     3,
     4,
     undef,
     0,
     undef,
   ],
   [
     7,
     "ResultRow",
     1,
     4,
     0,
     undef,
     0,
     undef,
   ],
   [
     8,
     "Next",
     0,
     3,
     0,
     undef,
     1,
     undef,
   ],
   [
     9,
     "Halt",
     0,
     0,
     0,
     undef,
     0,
     undef,
   ],
   [
     10,
     "Transaction",
     0,
     0,
     17,
     0,
     1,
     undef,
   ],
   [
     11,
     "Goto",
     0,
     1,
     0,
     undef,
     0,
     undef,
   ],
 ]

Pg

 [
   [
     "Seq Scan on \"Gnarly\" me  (cost=0.00..16.20 rows=620 width=100) (actual time=0.003..0.003 rows=0 loops=1)",
   ],
   [
     "Planning time: 0.102 ms",
   ],
   [
     "Execution time: 0.023 ms",
   ],
 ]

mysql

 [
   [
     1,
     "SIMPLE",
     "me",
     "ALL",
     undef,
     undef,
     undef,
     undef,
     1,
     100,
     "",
   ],
 ]

Releases

6 releases since Debian 8 (Jessie); the text changed 5 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13

Author

Arthur Axel "fREW" Schmidt <[email protected]>

From libdbix-class-helpers-perl 2.037000-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.