Re: PostgreSQL reads each 8k block - no larger blocks are used - even on sequential scans

From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: Sam Mason <sam(at)samason(dot)me(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL reads each 8k block - no larger blocks are used - even on sequential scans
Date: 2009-10-02 09:56:30
Message-ID: alpine.GSO.2.01.0910020551440.10008@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 27 Sep 2009, Sam Mason wrote:

> The first run of:
> select count(*) from benchmark;
> Will cause the "hint" bits to get set and will cause a lot of writing to
> happen. Subsequent runs will be testing read performance.

You just need to be careful of caching effects here. Either stop the
database and clear the system caches before doing the second count(*), or
pick a table size that's much larger than total system RAM so it's can't
possibly cache everything. Otherwise you'll just be reading back from
cached memory instead on the second read (and the first one, too, but
because of hint bits that result doesn't mean much anyway).

Sam's results represent the status quo as I'm used to seeing it: you
should see about the "wire speed" of the disk when pulling in data this
way, but both hint bits and checkpoints can slow results if you're not
careful to account for them. I keep meaning to add something just like
this as a second level example on top of dd/bonnie++ on my disk testing
page.

--
* Greg Smith gsmith(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hans-Juergen Schoenig 2009-10-02 10:13:05 Re: PGDay.EU 2009 - Call for lighting talks
Previous Message Greg Smith 2009-10-02 09:48:51 Re: PostgreSQL reads each 8k block - no larger blocks are used - even on sequential scans