cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Haddad (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-10214) Enable index selection to be overridden on a per query basis
Date Thu, 04 Feb 2016 22:48:39 GMT

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

Jon Haddad commented on CASSANDRA-10214:
----------------------------------------

The code example isn't clear on if this is per predicate or not.  I think it's going to be
especially necessary to select indexes per predicate with the introduction of CASSANDRA-10661.
 For instance, consider this list of predicates:

{code}
WHERE first_name LIKE 'J%' AND first_name LIKE '%an'
{code}

Here we might have 4 SASI indexes. 

1. case insensitive prefix
2. case sensitive prefix
3. case insensitive contains
4. case sensitive contains

I believe we'll need something like:
{code}
WHERE fname = 'J*' USING INDEX case_sensitive_name_prefix AND first_name LIKE '%an' USING
INDEX case_insensitive_name_contains
{code}

> Enable index selection to be overridden on a per query basis
> ------------------------------------------------------------
>
>                 Key: CASSANDRA-10214
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10214
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: CQL
>            Reporter: Sam Tunnicliffe
>            Assignee: Sam Tunnicliffe
>             Fix For: 3.x
>
>
> (Broken out of CASSANDRA-10124)
> We could add a {{USING INDEX <indexname>}} clause to {{SELECT}} syntax to force
the choice of index and bypass the usual index selection mechanism.
> {code}
> CREATE TABLE ks.t1(k int, v1 int, v2 int, PRIMARY KEY (k));
> CREATE INDEX v1_idx ON ks.t1(v1);
> CREATE INDEX v2_idx ON ks.t1(v2);
> CREATE CUSTOM INDEX v1_v2_idx ON ks.t1(v1, v2) USING 'com.foo.bar.CustomMultiColumnIndex';
> # Override internal index selection mechanism
> SELECT * FROM ks.t1 WHERE v1=0 AND v2=0 USING INDEX v1_idx;
> SELECT * FROM ks.t1 WHERE v1=0 AND v2=0 USING INDEX v2_idx;
> SELECT * FROM ks.t1 WHERE v1=0 AND v2=0 USING INDEX v1_v2_idx;
> {code}
> This is in some ways similar to [index hinting|http://docs.oracle.com/cd/B19306_01/server.102/b14211/hintsref.htm#CHDJDIAH]
in Oracle. 
> edit: fixed typo's (missing INDEX in the USING clauses)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message