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

Jonathan Ellis commented on CASSANDRA-4476:
-------------------------------------------

bq. we will need to modify SelectStatement to let queries with no-EQ clause 
pass validation

Is that just updating Type.allowsIndexQuery?  I also see EQ referenced in 
updateRestriction but I'm not really sure what's going on there.

bq. how do you estimate which index is likely to be the most selective

Well, we can compute the range of index partitions we'd need to scan, and we 
have stats on average cells-per-partition, so I think that gives us the 
cells-per-expression we need for highestSelectivityPredicate.

> Support 2ndary index queries with only non-EQ clauses
> -----------------------------------------------------
>
>                 Key: CASSANDRA-4476
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4476
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: API, Core
>            Reporter: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 2.1
>
>
> Currently, a query that uses 2ndary indexes must have at least one EQ clause 
> (on an indexed column). Given that indexed CFs are local (and use 
> LocalPartitioner that order the row by the type of the indexed column), we 
> should extend 2ndary indexes to allow querying indexed columns even when no 
> EQ clause is provided.
> As far as I can tell, the main problem to solve for this is to update 
> KeysSearcher.highestSelectivityPredicate(). I.e. how do we estimate the 
> selectivity of non-EQ clauses? I note however that if we can do that estimate 
> reasonably accurately, this might provide better performance even for index 
> queries that both EQ and non-EQ clauses, because some non-EQ clauses may have 
> a much better selectivity than EQ ones (say you index both the user country 
> and birth date, for SELECT * FROM users WHERE country = 'US' AND birthdate > 
> 'Jan 2009' AND birtdate < 'July 2009', you'd better use the birthdate index 
> first).



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to