From: Khangelani Gama <kgama@argility.com>
To: Venkata Balaji N <nag1010@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Postgres 9 : - How to interpret the EXPLAIN query results
Date: Thu, 26 Mar 2015 06:22:42 +0200
Message-ID: <53a085a60f456c87589e4b1224eaf369@mail.gmail.com> (raw)
In-Reply-To: <CAEyp7J-DgHgAj2tVQ7O9hg7zKVwLLPRGzYbozDxv8vuG0qENrw@mail.gmail.com>
References: <a5cf86e816f64005722ba22e878b3c44@mail.gmail.com>
<CAEyp7J-DgHgAj2tVQ7O9hg7zKVwLLPRGzYbozDxv8vuG0qENrw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>
*From:* Venkata Balaji N [mailto:nag1010@gmail.com]
*Sent:* 26 March 2015 05:00 AM
*To:* Khangelani Gama
*Cc:* pgsql-admin@postgresql.org
*Subject:* Re: [ADMIN] Postgres 9 : - How to interpret the EXPLAIN query
results
On Wed, Mar 25, 2015 at 7:00 PM, Khangelani Gama <kgama@argility.com> wrote:
Hi
Please help, how can I interpret the following results of my EXPLAIN query
?, I can see that the query will through 18586018 rows, but what’s the
meaning of cost and width?
GroupAggregate (cost=762381141.96..768375132.77 rows=18586018 width=32)
cost=762381141.96..768375132.77 means, cost of retrieving the first row is
762381141.96 and the cost of retrieving all the rows is 768375132.77.
rows=18586018 means, expected number of rows as an output.
width=32 means, width of each row scanned/retrieved is 32 bytes.
Cost calculation formula for PostgreSQL is as follows :
cost = (disk pages read * seq_page_cost) + (rows scanned * cpu_tuple_cost)
The above formula may help you analyze/reduce the cost of the query.
If you do an EXPLAIN ANALYZE (sample output is below), that will further
help you get more information like *query completion time in
milli-seconds* *(actual
time)*, *number of rows returned (rows)* and *how many iterations the query
went through to get the output (loop)*
GroupAggregate (cost=xxxx.xx..yyyyy.yy rows=xxxnx width=xx) (actual
time=(actual time=xxx.xx rows=xx loops=x)
Thanks,
Venkata Balaji N
Thank you very much !!
CONFIDENTIALITY NOTICE
The contents of and attachments to this e-mail are intended for the addressee only, and may contain the confidential
information of Argility (Proprietary) Limited and/or its subsidiaries. Any review, use or dissemination thereof by anyone
other than the intended addressee is prohibited.If you are not the intended addressee please notify the writer immediately
and destroy the e-mail. Argility (Proprietary) Limited and its subsidiaries distance themselves from and accept no liability
for unauthorised use of their e-mail facilities or e-mails sent other than strictly for business purposes.
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: kgama@argility.com, nag1010@gmail.com
Subject: Re: Postgres 9 : - How to interpret the EXPLAIN query results
In-Reply-To: <53a085a60f456c87589e4b1224eaf369@mail.gmail.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