Re: how to use all the options of EXPLAIN?

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: AI Rumman <rummandba(at)gmail(dot)com>
Cc: Toby Corkindale <toby(dot)corkindale(at)strategicdata(dot)com(dot)au>, pgsql-general(at)postgresql(dot)org
Subject: Re: how to use all the options of EXPLAIN?
Date: 2011-09-15 19:06:33
Message-ID: 1316113593.3666.13.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2011-09-15 at 12:17 +0600, AI Rumman wrote:
> When I am using the following query, I got shared hit=8857.
>
> EXPLAIN (buffers true, analyze) select * from act;
> QUERY
> PLAN
> --------------------------------------------------------------------------------------------------------------------------
> Seq Scan on act (cost=0.00..6308.82 rows=542312 width=735) (actual
> time=0.007..516.199 rows=542312 loops=1)
> Buffers: shared hit=8857
> Total runtime: 1004.067 ms
>
> Wherears, when I am using the following query, I got Buffers: shared
> hit=416 read=46350
>
> EXPLAIN (buffers true, analyze) select * from crm;
>
> QUERY
> PLAN
> -------------------------------------------------------------------------------------------------------------------------------
> Seq Scan on crm (cost=0.00..21558.94 rows=1688234 width=333) (actual
> time=0.040..1738.903 rows=1688291 loops=1)
> Buffers: shared hit=416 read=46350
> Total runtime: 3257.872 ms
>
> Could you please tell me why the different that is why I get read for one
> query and not for others?
>

The act table was in PostgreSQL cache memory, so it reads it from there.
A small part of the crm table was in PostgreSQL cache memory, it read
this part from there, but had to ask the OS to get the rest of the table
from the OS memory or from disk.

--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Adams 2011-09-15 19:30:10 Re: Remote connection shows localhost databases
Previous Message Andy Colson 2011-09-15 19:05:36 Re: Apparent Problem With NULL in Restoring pg_dump