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

From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: Gerhard Wiesinger <lists(at)wiesinger(dot)com>
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 20:29:06
Message-ID: alpine.GSO.2.01.0910021620131.13300@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2 Oct 2009, Gerhard Wiesinger wrote:

> Larger blocksizes also reduce IOPS (I/Os per second) which might be a critial
> threshold on storage systems (e.g. Fibre Channel systems).

True to some extent, but don't forget that IOPS is always relative to a
block size in the first place. If you're getting 200 IOPS with 8K blocks,
increasing your block size to 128K will not result in your getting 200
IOPS at that larger size; the IOPS number at the larger block size is
going to drop too. And you'll pay the penalty for that IOPS number
dropping every time you're accessing something that would have only been
an 8K bit of I/O before.

The trade-off is very application dependent. The position you're
advocating, preferring larger blocks, only makes sense if your workload
consists mainly of larger scans. Someone who is pulling scattered records
from throughout a larger table will suffer with that same change, because
they'll be reading a minimum of 128K even if all they really needed with a
few bytes. That penalty ripples all the way from the disk I/O upwards
through the buffer cache.

It's easy to generate a synthetic benchmark workload that models some
real-world applications and see performance plunge with a larger block
size. There certainly are others where a larger block would work better.
Testing either way is complicated by the way RAID devices usually have
their own stripe sizes to consider on top of the database block size.

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2009-10-02 21:16:19 Re: Limit of bgwriter_lru_maxpages of max. 1000?
Previous Message Greg Smith 2009-10-02 20:19:17 Re: Limit of bgwriter_lru_maxpages of max. 1000?