You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Techy Teck <co...@gmail.com> on 2013/11/08 02:54:26 UTC
Create an index on CQL table
I am using the below table in our use case -
create table testing1 (
employee_id text,
employee_name text,
value text,
last_modified_date timeuuid,
primary key (employee_name,last_modified_date)
);
In my above table employee_id will be unique always starting from 1 till
32767. So one of our query pattern is like this -
give me everything for any employee_id?
So I am thinking of creating an index on employee_id as in the current
design employee_id is not part of any key so we cannot query on that..
So that is the reason I am thinking to create an index on that. Keeping in
mind that employee_id won't be larger than 32767 so maximum number of rows
will be 32767 in the above table..
keeping that in mind will there be any problem if I am creating an index on
employee_id?
Re: Create an index on CQL table
Posted by Techy Teck <co...@gmail.com>.
@Jacob - See my this question with the subject - *CQL Tables in Cassandra
with an Index*
I just send it out.. Sorry for duplicacy.. After I posted it out, I realize
I missed the important details..
On Thu, Nov 7, 2013 at 6:52 PM, Jacob Rhoden <ja...@me.com> wrote:
>
>
> > On 8 Nov 2013, at 12:54 pm, Techy Teck <co...@gmail.com> wrote:
> >
> > I am using the below table in our use case -
> >
> > create table testing1 (
> > employee_id text,
> > employee_name text,
> > value text,
> > last_modified_date timeuuid,
> > primary key (employee_name,last_modified_date)
> > );
>
> Before considering secondary keys, what's the reason for this primary key?
>
> 1. What happens if two employees have the same name?
>
> 2. Why is last_modified_date in the primary key?
>
>
>
Re: Create an index on CQL table
Posted by Jacob Rhoden <ja...@me.com>.
> On 8 Nov 2013, at 12:54 pm, Techy Teck <co...@gmail.com> wrote:
>
> I am using the below table in our use case -
>
> create table testing1 (
> employee_id text,
> employee_name text,
> value text,
> last_modified_date timeuuid,
> primary key (employee_name,last_modified_date)
> );
Before considering secondary keys, what's the reason for this primary key?
1. What happens if two employees have the same name?
2. Why is last_modified_date in the primary key?