Search Postgresql Archives

Re: forcing use of a specific (expression) index?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Dan Weber" <weberdan@xxxxxxxxx> writes:
> I have the following query:

> SELECT columns FROM my_table WHERE (bool_1 or int_1 = 0)
> AND (int_2 IS NULL) AND (int_3 IS NULL) AND (protocol =
> 2) ORDER BY id LIMIT 1;

> I made an expression index specifically for that where clause:

> CREATE INDEX special_testing_idx on my_table (((bool_1 or
> int_1 = 0) AND (int_2 IS NULL) AND (int_3 IS
> NULL) AND (protocol = 2)));

A partial index would be WAY more useful than that:

create index on my_table(id) where (bool_1 or int_1 = 0) ...

			regards, tom lane


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux