[
https://issues.apache.org/jira/browse/CASSANDRA-3680?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sylvain Lebresne updated CASSANDRA-3680:
----------------------------------------
Attachment: 0001-Secondary-indexes-on-composite-columns.txt
Attaching initial patch to support indexing on composites. This basically
supports indexing a slice of columns based on the value of one of these
columns. In other words, given definition
{noformat}
CREATE TABLE blogs (
blog_id int,
posted_at timestamp,
author text,
content text,
PRIMARY KEY (blog_id, posted_at)
)
{noformat}
It allows to create index:
{noformat}
CREATE INDEX ON blogs(author);
{noformat}
The patch does not however support indexing on PRIMARY KEY part, but I believe
this is a different enough problem that this could be left to a separate ticket.
The indexing itself is a slight variation on our current KeysIndex, but where
each index column holds a row key and a column name prefix instead of just the
row key. Technically however, there is a few difficulties:
* The code to query secondary indexes is a bit too wired to one row per index
column, which is not the case anymore. The patch hacks around that but this is
arguably a bit ugly. I don't have a better solution however.
* Index locking during index built is row based. With this, large rows can have
lots and lots of indexed columns. It follows that index rebuild might have to
lock the row for a long time. The patch tries to mitigate that by paging on
wide row and releasing the lock between page to let writes make progress but in
practice this probably mean that index rebuild will have a more heavy impact on
a live node.
* For the same reason, when doing a row delete, we might have lots of indexed
columns mutated and we have to read the whole row to know which one that is.
This might make such updates fairly expensive since in that case too the whole
row will be locked in the process. The best fix for this is probably
CASSANDRA-2897.
> Add Support for Composite Secondary Indexes
> -------------------------------------------
>
> Key: CASSANDRA-3680
> URL: https://issues.apache.org/jira/browse/CASSANDRA-3680
> Project: Cassandra
> Issue Type: Sub-task
> Reporter: T Jake Luciani
> Assignee: Sylvain Lebresne
> Labels: cql3, secondary_index
> Attachments: 0001-Secondary-indexes-on-composite-columns.txt
>
>
> CASSANDRA-2474 and CASSANDRA-3647 add the ability to transpose wide rows
> differently, for efficiency and functionality secondary index api needs to be
> altered to allow composite indexes.
> I think this will require the IndexManager api to have a
> maybeIndex(ByteBuffer column) method that SS can call and implement a
> PerRowSecondaryIndex per column, break the composite into parts and index
> specific bits, also including the base rowkey.
> Then a search against a TRANSPOSED row or DOCUMENT will be possible.
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira