Re: improving speed of query that uses a multi-column "filter" ?

From: Jonathan Vanasco <postgres(at)2xlp(dot)com>
To: "pgsql-general(at)postgresql(dot)org general" <pgsql-general(at)postgresql(dot)org>
Cc: Misa Simic <misa(dot)simic(at)gmail(dot)com>
Subject: Re: improving speed of query that uses a multi-column "filter" ?
Date: 2014-10-01 16:12:33
Message-ID: 657A6E9C-53C7-4A79-A22C-D13CE3954FB9@2xlp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Oct 1, 2014, at 12:34 AM, Misa Simic wrote:

> Have you considered maybe partial indexes?
>
> http://www.postgresql.org/docs/9.3/static/indexes-partial.html
>
> I.e idx1 on pk column of the table with where inside index exactly the same as your first where
>
> Idx2 on pk column with where inside index as second where

That was actually my first attempt , and I was hoping it would work.

Unfortunately, there is always something in the queries that keeps Postgres trying to use other (slower) indexes or jumping to a sequential scan.

I haven't been able to trick the planner into using the partial index, and most online resources suggested it wasn't possible.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message François Beausoleil 2014-10-01 17:46:30 Is there a way to get both the plan and the results?
Previous Message David G Johnston 2014-10-01 15:56:43 Re: Extract especific text from a sql statement