phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Taylor <jamestay...@apache.org>
Subject Re: using index with "or" query
Date Tue, 19 Sep 2017 15:14:30 GMT
Hi Noam,
A few ideas:
1) Use a UNION instead of an OR and you may be able to use more than one
index for one query.
2) Include the columns you're referencing in the index to make it a covered
index [1].
3) Hint [2] the query to force the index to be used.

Thanks,
James

[1] http://phoenix.apache.org/secondary_indexing.html#Index_Usage (#1)
[2] http://phoenix.apache.org/secondary_indexing.html#Index_Usage (#2)

On Tue, Sep 19, 2017 at 4:21 AM Bulvik, Noam <Noam.Bulvik@teoco.com> wrote:

> Hi,
>
>
>
> We have a case where we have a table with few index on different columns
> a, b, c  etc' . It works well if we do select with "and" condition  (for
> example select …. Where a='xyz' and b='123' )but when we have or condition
> (for example select …. Where a='xyz' or b='123') we get full scan even
> though we have index on a and on b.
>
>
>
> Is there a way to get this query to use indexes and not full scan beside
> creating index on all available column combination (index on a+b , index on
> a +c …)
>
>
>
>
>
> Regards,
>
>
>
> *Noam *
>
>
>
> ------------------------------
>
> PRIVILEGED AND CONFIDENTIAL
> PLEASE NOTE: The information contained in this message is privileged and
> confidential, and is intended only for the use of the individual to whom it
> is addressed and others who have been specifically authorized to receive
> it. If you are not the intended recipient, you are hereby notified that any
> dissemination, distribution or copying of this communication is strictly
> prohibited. If you have received this communication in error, or if any
> problems occur with transmission, please contact sender. Thank you.
>

Mime
View raw message