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