[ 
https://issues.apache.org/jira/browse/PHOENIX-6045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17165138#comment-17165138
 ] 

Lars Hofhansl edited comment on PHOENIX-6045 at 7/27/20, 6:29 AM:
------------------------------------------------------------------

I think that would never work. If you don't find the keys you need to delete 
the other indexes you'd have to scan those too (or the main table). That is 
true whether the index is evaluated client side or not.

There's specific logic for this in DeleteCompiler. I recently looked at this 
and removed that restriction for local indexes.

I'm not at a computer atm. But I could also not see how it would work 
logically. As usually, I might also be missing something... :)

Edit: The comments in the code say otherwise. Still I do not understand how 
this can work efficiently. If I have two global indexes on C1 the other on C2. 
In order to delete from the first index I need to the PK(s) and C1, and PK(s) 
and C2 for the second index. In that case I can't scan either of the two 
indexes to get all the information I need. Say the delete filters on C1 and I 
use the first index, how would I get the value of C2? It's not part of that 
index, so I would need to retrieve the remainder of the row for all PKs that 
match the index in order to the value of C2 that I need to clean out that 
index. So either the comment is incorrect or I am missing something.


was (Author: lhofhansl):
I think that would never work. If you don't find the keys you need to delete 
the other indexes you'd have to scan those too (or the main table). That is 
true whether the index is evaluated client side or not.

There's specific logic for this in DeleteCompiler. I recently looked at this 
and removed that restriction for local indexes.

I'm not at a computer atm. But I could also not see how it would work 
logically. As usually, I might also be missing something... :)

> Delete that should qualify for index path does not use index when multiple 
> indexes are available.
> -------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-6045
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6045
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 5.0.0, 4.15.0, 4.14.3
>            Reporter: Daniel Wong
>            Priority: Major
>             Fix For: 5.1.0, 4.16.0
>
>         Attachments: MultipleDeleteReproIT.java
>
>
> Delete that should qualify for index path does not use index when multiple 
> indexes are available.  Test case to reproduce will be below.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to