Re: temporary indexes?

From: Jonathan Vanasco <postgres(at)2xlp(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: temporary indexes?
Date: 2015-10-22 22:22:51
Message-ID: 8F7D0E78-C82C-49C2-B5EE-D87DD1934E25@2xlp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Oct 22, 2015, at 5:04 PM, Jim Nasby wrote:

>
> What % of execution time is spent creating those indexes? Or is that factored into the 1000%? Also, could your analysis queries be run in a REPEATABLE READ transaction (meaning that once the transaction starts it doesn't get any new data)? If it could then the temp indexes could be static, which would mean no update overhead.

Running without the indexes would take over an hour to execute the scripts, and totally jams the machine (we got 30minutes in once, and had to kill it). That's because of millions of rows used in joins and sequential scans.

Building all the indexes takes 30 seconds; most SQL commands then run only against the indexes (some of which are partial) and the entire suite finishes in about 3 minutes.

If the indexes stay active during the day, there seems to be a 2-3% drop in write performance. This is on a webapp, so we're just happier shifting the index work from peak hours to offpeak hours. It means we can delay spinning up another application server a bit longer.

I'll definitely look into your suggestions the next time I hit this code.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Munro 2015-10-22 22:54:25 Re: A question about PL/pgSQL DECLAREd variable behavior
Previous Message Dane Foster 2015-10-22 21:27:52 Re: A question about PL/pgSQL DECLAREd variable behavior