pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Neil Whelchel <neil.whelchel@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Slow count(*) again...
Date: Wed, 13 Oct 2010 09:49:12 -0400
Message-ID: <24768.1286977752@sss.pgh.pa.us> (raw)
In-Reply-To: <201010122347.20542.neil.whelchel@gmail.com>
References: <201010091626.18636.neil.whelchel@gmail.com>
	<4CB2410C.6010603@postnewspapers.com.au>
	<201010102115.58729.neil.whelchel@gmail.com>
	<201010122347.20542.neil.whelchel@gmail.com>

Neil Whelchel <neil.whelchel@gmail.com> writes:
> Insert the data into one table:
> crash:~# time psql -U test test -q < log.sql
> real    679m43.678s
> user    1m4.948s
> sys     13m1.893s

> crash:~# echo 3 > /proc/sys/vm/drop_caches
> crash:~# time psql -U test test -c "SELECT count(*) FROM log;" 
>   count   
> ----------
>  10050886
> (1 row)

> real    0m11.812s
> user    0m0.000s
> sys     0m0.004s

> crash:~# time psql -U test test -c "SELECT count(*) FROM log;" 
>   count   
> ----------
>  10050886
> (1 row)

> real    0m3.737s
> user    0m0.000s
> sys     0m0.000s

> As can be seen here, the cache helps..

That's probably got little to do with caching and everything to do with
setting hint bits on the first SELECT pass.

I concur with Mark's question about whether your UPDATE pushed the table
size across the limit of what would fit in RAM.

			regards, tom lane



view thread (246+ messages)  latest in thread

Message-ID: <24768.1286977752@sss.pgh.pa.us>
Permalink:  ../24768.1286977752@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24768.1286977752@sss.pgh.pa.us

 · 

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-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, neil.whelchel@gmail.com
  Subject: Re: Slow count(*) again...
  In-Reply-To: <24768.1286977752@sss.pgh.pa.us>

* 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