X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E0F779DCC32 for ; Wed, 15 Feb 2006 19:02:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42361-07 for ; Wed, 15 Feb 2006 19:02:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id DE9889DCC2B for ; Wed, 15 Feb 2006 19:02:47 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id k1FN2lTd020581; Wed, 15 Feb 2006 18:02:47 -0500 (EST) To: "Owen Jacobson" cc: pgsql-sql@postgresql.org Subject: Re: How to force PostgreSQL using an index In-reply-to: <144D12D7DD4EC04F99241498BB4EEDCC220865@nelson.osl.com> References: <144D12D7DD4EC04F99241498BB4EEDCC220865@nelson.osl.com> Comments: In-reply-to "Owen Jacobson" message dated "Wed, 15 Feb 2006 14:32:48 -0800" Date: Wed, 15 Feb 2006 18:02:47 -0500 Message-ID: <20580.1140044567@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.11 required=5 tests=[AWL=0.110] X-Spam-Score: 0.11 X-Spam-Level: X-Archive-Number: 200602/194 X-Sequence-Number: 24204 "Owen Jacobson" writes: > On Wed, Feb 15, 2006 at 04:58:54PM -0500, Daniel Caune wrote: >> I see, but that doesn't explain whether it is possible to specify the >> index to use. It seems that those options just force PostgreSQL using >> another plan. > Drop the simple index and re-create it when you're done? BTW, the cute way to do that is BEGIN; DROP INDEX unwanted; EXPLAIN ANALYZE whatever...; ROLLBACK; No need to actually rebuild the index when you are done. This does hold an exclusive lock on the table for the duration of your experiment, so maybe not such a good idea in a live environment ... but then again, dropping useful indexes in a live environment isn't a good idea either, and this at least reduces the duration of the experiment by a good deal. regards, tom lane