pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Smith <greg@2ndQuadrant.com>
To: pgsql-performance@postgresql.org
Subject: Re: Multiple index builds on same table - in one sweep?
Date: Sun, 10 Apr 2011 22:29:49 -0400
Message-ID: <4DA2679D.5000207@2ndQuadrant.com> (raw)
In-Reply-To: <DBEFE6AF-E8CE-4508-A8C3-A0E5E0987EFE@ruprecht.org>
References: <DD8709CB-474F-4002-B555-1ED974371364@ruprecht.org>
	<4325.1302369004@sss.pgh.pa.us>
	<DBEFE6AF-E8CE-4508-A8C3-A0E5E0987EFE@ruprecht.org>

On 04/09/2011 01:23 PM, Chris Ruprecht wrote:
> Maybe, in a future release, somebody will develop something that can create indexes as inactive and have a build tool build and activate them at the same time. Food for thought?
>    

Well, the most common case where this sort of thing happens is when 
people are using pg_restore to load a dump of an entire database.  In 
that case, you can use "-j" to run more than one loader job in parallel, 
which can easily end up doing a bunch of index builds at once, 
particularly at the end.  That already works about as well as it can 
because of the synchronized scan feature Tom mentioned.

I doubt you'll ever get much traction arguing for something other than 
continuing to accelerate that path; correspondingly, making your own 
index builds look as much like it as possible is a good practice.  Fire 
up as many builds as you can stand in parallel and see how many you can 
take given the indexes+data involved.  It's not clear to me how a create 
as inactive strategy could improve on that.

There are some types of index build operations that bottleneck on CPU 
operations, and executing several of those in parallel can be a win.  At 
some point you run out of physical I/O, or the additional memory you're 
using starts taking away too much from caching.  Once you're at that 
point, it's better to build the indexes on another pass, even if it 
requires re-scanning the table data to do it.  The tipping point varies 
based on both system and workload, it's very hard to predict or automate.

-- 
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books




view thread (11+ messages)  latest in thread

Message-ID: <4DA2679D.5000207@2ndQuadrant.com>
Permalink:  ../4DA2679D.5000207@2ndQuadrant.com/
Also on:    postgresql.org/message-id/4DA2679D.5000207@2ndQuadrant.com

 · 

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: greg@2ndQuadrant.com
  Subject: Re: Multiple index builds on same table - in one sweep?
  In-Reply-To: <4DA2679D.5000207@2ndQuadrant.com>

* 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