Re: temporary indexes? - Mailing list pgsql-general

From Jonathan Vanasco
Subject Re: temporary indexes?
Date
Msg-id 1E047FE6-F40B-486E-A70E-9A5C9D9741EB@2xlp.com
Whole thread Raw
In response to Re: temporary indexes?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: temporary indexes?  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
List pgsql-general

On Oct 22, 2015, at 2:08 PM, Tom Lane wrote:
> FWIW, I don't find much attraction in the idea of building an index for
> use by a single query.  There basically isn't any scenario where that's
> going to beat running a plan that doesn't require the index.  The value of
> an index is generally to avoid a whole-table scan and/or a sort, but
> you'll necessarily pay those costs to make the index.


On Oct 22, 2015, at 8:17 AM, vincent elschot wrote:
> Do you mean creating a temporary index on a non-temporary table to speed up the queries that fills the temporary
table?

One of the use-cases is speeding up inserts on create, but another is for periodic analytics routines (which we handle
withexplicit create/drop index commands. 

In one example of our analytics routines, we end up needing to create/drop about 15 indexes to optimize 45 queries.
Thisspeeds up the execution by 1000% and minimizes RAM usage.  We don't keep the indexes active, because we only need
themfor analytics and the overhead of managing them during high write periods during the day is noticeable.  Creating
anddropping these indexes on-demand gives us all the benefit with none of the drawbacks. 

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: trouble downloading postgres 9.4 for RHEL 6.x
Next
From: anj patnaik
Date:
Subject: Re: trouble downloading postgres 9.4 for RHEL 6.x