From: | François Beausoleil <francois(at)teksol(dot)info> |
---|---|
To: | Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Is it possible to create row-wise indexable condition for special case... |
Date: | 2012-08-06 13:09:24 |
Message-ID: | 8F808C79-81E1-4638-8C3A-B2D03541A705@teksol.info |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Le 2012-08-06 à 01:39, Maxim Boguk a écrit :
> I know that for condition like ((field1>value1) or (field1=value1 and field2>value2)) I could built index on (field1, field2) and use indexable condition like (field1, field2) > (value1, value2).
>
> However, I have very tricky query which requires an indexable condition like (field1>value1) or (field1=value1 and field2<value2).
> I guess that I could use index definition like ON(field1, field2 DESC) however, I can not build query condition which would use that index effectively.
>
> Is it possible and my mind just went black on simple task?
>
> PS: field2 is varchar type so I couldn't using the negative values trick
> build index ON(field1, (-field2))
> and write something like WHERE (field1, -field2) > (value1, -value2).
>
> --
> Maxim Boguk
> Senior Postgresql DBA
> http://www.postgresql-consulting.ru/
>
Could you perhaps use bitmapped indexes? Such that you'd have two indexes, and the optimizer would AND the two indexes together?
Hope that helps!
François
From | Date | Subject | |
---|---|---|---|
Next Message | Condor | 2012-08-06 14:23:14 | How to analyze load average ? |
Previous Message | Marek Kielar | 2012-08-06 12:08:43 | Re: Clogging problem (was: Schema-only dump dumps no constraints, no triggers) |