pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: Markus Bertheau <mbertheau.pg@googlemail.com>
To: Joshua D. Drake <jd@commandprompt.com>
To: Peter Koczan <pjkoczan@gmail.com>
To: Scott Marlowe <scott.marlowe@gmail.com>
To: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: disabling an index without deleting it?
Date: Wed, 27 Feb 2008 18:33:01 -0500
Message-ID: <12278.1204155181@sss.pgh.pa.us> (raw)
In-Reply-To: <10385.1204153217@sss.pgh.pa.us>
References: <4544e0330802261246t574167fdpc47629d1bbe64fed@mail.gmail.com>
	<dcc563d10802261257h6abfbc92x62a7569b8610ecc4@mail.gmail.com>
	<20080226130339.64bd4ec3@commandprompt.com>
	<9050.1204064560@sss.pgh.pa.us>
	<684362e10802261848j79686752k6dfbe032e985b131@mail.gmail.com>
	<684362e10802261848j79686752k6dfbe032e985b131@mail.gmail.com>
	<13604.1204087729@sss.pgh.pa.us>
	<47C578A1.EE98.0025.0@wicourts.gov>
	<10385.1204153217@sss.pgh.pa.us>

I wrote:
> In the particular case at hand, a planner hook to make it ignore the
> index is a far better solution anyway...

Just as proof of concept, a quick-and-dirty version of this is attached.
It works in 8.3 and up.  Sample (after compiling the .so):

regression=# load '/home/tgl/pgsql/planignoreindex.so';
LOAD
regression=# explain select * from tenk1 where unique1 = 42;
                                 QUERY PLAN                                  
-----------------------------------------------------------------------------
 Index Scan using tenk1_unique1 on tenk1  (cost=0.00..8.27 rows=1 width=244)
   Index Cond: (unique1 = 42)
(2 rows)

regression=# set ignore_index TO 'tenk1_unique1';
SET
regression=# explain select * from tenk1 where unique1 = 42;
                       QUERY PLAN                        
---------------------------------------------------------
 Seq Scan on tenk1  (cost=0.00..483.00 rows=1 width=244)
   Filter: (unique1 = 42)
(2 rows)

regression=# 

			regards, tom lane

view thread (18+ messages)  latest in thread

Message-ID: <12278.1204155181@sss.pgh.pa.us>
Permalink:  ../12278.1204155181@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12278.1204155181@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, Kevin.Grittner@wicourts.gov, mbertheau.pg@googlemail.com, jd@commandprompt.com, pjkoczan@gmail.com, scott.marlowe@gmail.com
  Subject: Re: disabling an index without deleting it?
  In-Reply-To: <12278.1204155181@sss.pgh.pa.us>

* 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