pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
read block size
3+ messages / 2 participants
[nested] [flat]

* read block size
@ 2005-06-28 15:27  Michael Stone <mstone+postgres@mathom.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Stone @ 2005-06-28 15:27 UTC (permalink / raw)
  To: pgsql-performance

Is it possible to tweak the size of a block that postgres tries to read
when doing a sequential scan? It looks like it reads in fairly small
blocks, and I'd expect a fairly significant boost in i/o performance
when doing a large (multi-gig) sequential scan if larger blocks were
used.

Mike Stone



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: read block size
@ 2005-06-28 17:02  John A Meinel <john@arbash-meinel.com>
  parent: Michael Stone <mstone+postgres@mathom.us>
  0 siblings, 1 reply; 3+ messages in thread

From: John A Meinel @ 2005-06-28 17:02 UTC (permalink / raw)
  To: Michael Stone <mstone+postgres@mathom.us>; +Cc: pgsql-performance

Michael Stone wrote:

> Is it possible to tweak the size of a block that postgres tries to read
> when doing a sequential scan? It looks like it reads in fairly small
> blocks, and I'd expect a fairly significant boost in i/o performance
> when doing a large (multi-gig) sequential scan if larger blocks were
> used.
>
> Mike Stone


I believe postgres reads in one database page at a time, which defaults
to 8k IIRC. If you want bigger, you could recompile and set the default
page size to something else.

There has been discussion about changing the reading/writing code to be
able to handle multiple pages at once, (using something like vread())
but I don't know that it has been implemented.

Also, this would hurt cases where you can terminate as sequential scan
early. And if the OS is doing it's job right, it will already do some
read-ahead for you.

John
=:->

Attachments:

  signature.asc (application/pgp-signature, 252B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: read block size
@ 2005-06-28 17:27  Michael Stone <mstone+postgres@mathom.us>
  parent: John A Meinel <john@arbash-meinel.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Stone @ 2005-06-28 17:27 UTC (permalink / raw)
  To: John A Meinel <john@arbash-meinel.com>; +Cc: pgsql-performance

On Tue, Jun 28, 2005 at 12:02:55PM -0500, John A Meinel wrote:
>There has been discussion about changing the reading/writing code to be
>able to handle multiple pages at once, (using something like vread())
>but I don't know that it has been implemented.

that sounds promising

>Also, this would hurt cases where you can terminate as sequential scan
>early. 

If you're doing a sequential scan of a 10G file in, say, 1M blocks I
don't think the performance difference of reading a couple of blocks
unnecessarily is going to matter.

>And if the OS is doing it's job right, it will already do some
>read-ahead for you.

The app should have a much better idea of whether it's doing a
sequential scan and won't be confused by concurrent activity. Even if
the OS does readahead perfectly, you'll still get a with with larger
blocks by cutting down on the syscalls.

Mike Stone




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2005-06-28 17:27 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-06-28 15:27 read block size Michael Stone <mstone+postgres@mathom.us>
2005-06-28 17:02 ` John A Meinel <john@arbash-meinel.com>
2005-06-28 17:27   ` Michael Stone <mstone+postgres@mathom.us>

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