[
https://issues.apache.org/jira/browse/PHOENIX-4531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16331138#comment-16331138
]
James Taylor commented on PHOENIX-4531:
---------------------------------------
If the scan run for the delete is over an index table, we can't (currently) run
that on the server side because we don't have the code that'll translate from
the index row key to the data row key on the server side. In theory, if the
index is local or global and mutable, we could run it on the server side if
this code was there.
We do attempt to favor using the data table over the index table if all things
are equal from the optimizers POV. That's what this code a little above in
DeleteCompiler should do:
{code}
if (runOnServer &&
!delete.getHint().hasHint(Hint.USE_INDEX_OVER_DATA_TABLE)) {
select = SelectStatement.create(select, HintNode.create(hint,
Hint.USE_DATA_OVER_INDEX_TABLE));
}
{code}
I'd expect that hint to cause the data table, not the index table to be used if
there's no WHERE clause. Perhaps this isn't working as expected?
It's not entirely clear what the best choice is, though. If the index table is
much smaller in size than the data table, is it better to execute the scan
against the index table, pull back over the row key and issue the deletes from
the client? Or is it better to execute the delete on the server side (though
it'd be a cross RS call)?
WDYT? Maybe if this is pursued it should be a separate JIRA, though?
> Delete on a table with a global mutable index can issue client-side deletes
> against the index
> ---------------------------------------------------------------------------------------------
>
> Key: PHOENIX-4531
> URL: https://issues.apache.org/jira/browse/PHOENIX-4531
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.13.0
> Environment:
> Reporter: Vincent Poon
> Assignee: Vincent Poon
> Priority: Major
> Attachments: PHOENIX-4531.v1.master.patch, PHOENIX-4531_v1.patch,
> PartialIndexRebuilderIT.java
>
>
> For a table with a global mutable index, I found the following result in
> client-side deletes against both the data table and index table.
> "DELETE FROM data_table"
> "DELETE FROM data_table WHERE indexed_col='v'"
> We only need the delete to be issued against the data table, because
> 1) It's redundant since a delete against the index will be issued on the
> server side when we process the delete of the data table row
> 2) Deletes issued from the client-side won't have the index failure policy
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)