pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hubert depesz lubaczewski <depesz@depesz.com>
To: Siraj G <tosiraj.g@gmail.com>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Not clear with the Explain Plan output
Date: Mon, 13 May 2024 18:16:13 +0200
Message-ID: <ZkI8zYzpoAAG0qGi@depesz.com> (raw)
In-Reply-To: <CAC5iy60e7T3LUcVN94pOYxgnxvQPqrMUv-87qCUNnNoC_+gvLw@mail.gmail.com>
References: <CAC5iy60e7T3LUcVN94pOYxgnxvQPqrMUv-87qCUNnNoC_+gvLw@mail.gmail.com>

On Mon, May 13, 2024 at 09:07:14PM +0530, Siraj G wrote:
> Hello experts!
> 
> I am new in the PgSQL domain, so I need assistance in understanding the
> explain plan. I took the plan of a SQL via PgAdmin and it looks like the
> attached one. I am unable to see the numbers that indicate where the heavy
> processing is being done, to determine the IO and cpu processing.
> 
> Is this the right way to collect explain plan? If so, how do I interpret
> this? If there is another or a better way to collect this, please let me
> know.

Just run 'explain analyze' and read the text output. Graphs, in my
opinion, hide too much info.

Normal explain looks like:

#v+
                                                                  QUERY PLAN
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 Sort  (cost=35.41..35.50 rows=35 width=224) (actual time=0.160..0.162 rows=4 loops=1)
   Sort Key: n.nspname, c.relname
   Sort Method: quicksort  Memory: 25kB
   Buffers: shared hit=15
   ->  Hash Join  (cost=1.09..34.51 rows=35 width=224) (actual time=0.046..0.153 rows=4 loops=1)
         Hash Cond: (c.relnamespace = n.oid)
         Buffers: shared hit=15
         ->  Seq Scan on pg_class c  (cost=0.00..32.16 rows=70 width=77) (actual time=0.009..0.107 rows=146 loops=1)
               Filter: ((relkind = ANY ('{r,p,v,m,S,f,""}'::"char"[])) AND pg_table_is_visible(oid))
               Rows Removed by Filter: 280
               Buffers: shared hit=14
         ->  Hash  (cost=1.07..1.07 rows=2 width=68) (actual time=0.029..0.029 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.07 rows=2 width=68) (actual time=0.013..0.015 rows=2 loops=1)
                     Filter: ((nspname <> 'pg_catalog'::name) AND (nspname !~ '^pg_toast'::text) AND (nspname <> 'information_schema'::name))
                     Rows Removed by Filter: 3
                     Buffers: shared hit=1
 Planning:
   Buffers: shared hit=9
 Planning Time: 0.204 ms
 Execution Time: 0.189 ms
(22 rows)
#v-

Best regards,

depesz






view thread (2+ messages)

Message-ID: <ZkI8zYzpoAAG0qGi@depesz.com>
Permalink:  ../ZkI8zYzpoAAG0qGi@depesz.com/
Also on:    postgresql.org/message-id/ZkI8zYzpoAAG0qGi@depesz.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: depesz@depesz.com, tosiraj.g@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Not clear with the Explain Plan output
  In-Reply-To: <ZkI8zYzpoAAG0qGi@depesz.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox