Skip site navigation (1) Skip section navigation (2)

Re: [PERFORMANCE] expanding to SAN: which portion best to move

From: Robert Klemme <shortcutter(at)googlemail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Willy-Bas Loos <willybas(at)gmail(dot)com>, Jesper Krogh <jesper(at)krogh(dot)cc>, pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORMANCE] expanding to SAN: which portion best to move
Date: 2011-05-17 07:00:31
Message-ID: BANLkTin+fqFBktSG9c=XJ=rAOi2K-H9eVA@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-performance
On Mon, May 16, 2011 at 4:31 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Mon, May 16, 2011 at 4:19 AM, Robert Klemme
> <shortcutter(at)googlemail(dot)com> wrote:
>>> - If the planner chooses a Bitmap Index Scan, it effectively scans the
>>> index to figure out which table blocks to read, and then reads those
>>> table blocks in block number order, so that the I/O is sequential,
>>> with skips.
>>
>> Are these two separate phases (i.e. first scan index completely, then
>> access table)?
>
> Yes.

So then a single query will only ever access one of both at a time.

>> Separating index and tables might not be a totally good idea
>> generally.  Richard Foote has an excellent article about Oracle but I
>> assume at least a few things do apply to PostgreSQL as well - it's at
>> least worth as something to check PostgreSQL's access patterns
>> against:
>>
>> http://richardfoote.wordpress.com/2008/04/16/separate-indexes-from-tables-some-thoughts-part-i-everything-in-its-right-place/
>>
>> I would probably rather try to separate data by the nature and
>> frequency of accesses.  One reasonable separation would be to leave
>> all frequently accessed tables *and* their indexes on local RAID and
>> moving less frequently accessed data to the SAN.  This separation
>> could be easily identified if you have separate tables for current and
>> historic data.
>
> Yeah, I think the idea of putting tables and indexes in separate
> tablespaces is mostly to bring more I/O bandwidth to bear on the same
> data.

Richard commented on that as well, I believe it was in
http://richardfoote.wordpress.com/2008/04/18/separate-indexes-from-tables-some-thoughts-part-ii-there-there/

The main point is that you do not benefit from the larger IO bandwidth
if access patterns do not permit parallel access to both disks (e.g.
because you first need to read index blocks in order to know the table
blocks to read).  The story might be different though if you have a
lot of concurrent accesses.  But even then, if the table is a hotspot
chances are that index blocks are cached and you only need physical IO
for table blocks...

>  But there are other reasonable things you might do also - e.g.
> put the indexes on an SSD, and the tables on a spinning disk, figuring
> that the SSD is less reliable but you can always rebuild the index if
> you need to...

Richard commented on that theory as well:
http://richardfoote.wordpress.com/2008/05/02/indexes-in-their-own-tablespace-recoverability-advantages-get-back/

The point: if you do the math you might figure that lost indexes lead
to so much downtime that you don't want to risk that and the rebuild
isn't all that simple (in terms of time).  For a reasonable sized
database recovery might be significantly faster than rebuilding.

> Also, a lot of people have reported big speedups from putting pg_xlog
> on a dedicated RAID 1 pair, or moving the PostgreSQL logs off the data
> partition.  So those sorts of divisions should be considered also.

Now, this is something I'd seriously consider because access patterns
to pg_xlog are vastly different than those of table and index data!
So you want to have pg_xlog on a device with high reliability and high
write speed.

> Your idea of dividing things by access frequency is another good
> thought.

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

In response to

Responses

pgsql-performance by date

Next:From: Clemens EissererDate: 2011-05-17 07:38:55
Subject: Re: hash semi join caused by "IN (select ...)"
Previous:From: Dave JohansenDate: 2011-05-17 02:44:20
Subject: Re: hash semi join caused by "IN (select ...)"

pgsql-general by date

Next:From: Gerhard HintermayerDate: 2011-05-17 08:06:22
Subject: ordering of join using ON expression = any (array)
Previous:From: Christopher OpenaDate: 2011-05-17 07:00:30
Subject: Re: Granting privileges on all tables,sequences , views, procedures

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group