You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2015/10/21 15:08:27 UTC
[jira] [Commented] (CASSANDRA-10560) Remove unnecessary index
lookups for single partition reads
[ https://issues.apache.org/jira/browse/CASSANDRA-10560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14966777#comment-14966777 ]
Sylvain Lebresne commented on CASSANDRA-10560:
----------------------------------------------
I'd actually kind of prefer not doing that, because I don't think this provides benefits and it's remotely risky.
I don't think it provides benefits because we're not really doing a lookup. The fact we don't use {{SinglePartitionReadCommand}} for indexes means that the {{RowFilter}} will be empty and in that case, {{SecondaryIndexManager.getBestIndexFor()}} exits right away. One exception might be filtering queries, which might have a non empty {{RowFilter}} but with nothing indexed, but I'm not sure we should worry about this very small cost when {{ALLOW FILTERING}} is involved in the first place.
It's also potentially risky because while {{SelectStatement}} currently indeed never uses {{SinglePartitionReadCommand}}, nothing forbid other internal queries to do so. I'm sure no internal query currently uses that, but it would be easy to mess up. It's not reasonable to expect that everyone contributing will know that {{SinglePartitionReadCommand}} seemingly randomly (and silently) skips indexes. At a minimum, this might make whomever changes {{SelectStatement}} so it stops avoiding {{SinglePartitionReadCommand}} for index scratch his head for a long time to figure out why this doesn't work (and there is absolutely no good reason not to use {{SinglePartitionReadCommand}} for indexes, so we should do this change very soon).
> Remove unnecessary index lookups for single partition reads
> -----------------------------------------------------------
>
> Key: CASSANDRA-10560
> URL: https://issues.apache.org/jira/browse/CASSANDRA-10560
> Project: Cassandra
> Issue Type: Bug
> Reporter: Sam Tunnicliffe
> Assignee: Sam Tunnicliffe
> Fix For: 3.0.0
>
>
> For single partition reads, we currently perform an unnecessary call to SecondaryIndexManager to lookup the most selective index based on the command's RowFilter. This is redundant as if any applicable indexes are present, the query would be performed using a range command (there was some code introduced into {{CassandraIndexSearcher}} by CASSANDRA-8099 in preparation for supporting indexes on single partition reads, but it is as yet unused). Given that, we should make sure we don't perform that lookup for now.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)