You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by mahesh rajamani <ra...@gmail.com> on 2014/05/15 20:54:08 UTC

Index with same Name but different keyspace

Hi,

I am using Cassandra 2.0.5 version. I trying to setup 2 keyspace with same
tables for different testing. While creating index on the tables, I
realized I am not able to use the same index name  though the tables are in
different keyspaces. Is maintaining unique index name across keyspace is
must/feature?

-- 
Regards,
Mahesh Rajamani

Re: Index with same Name but different keyspace

Posted by Bryan Talbot <br...@playnext.com>.
On Mon, May 19, 2014 at 6:39 AM, mahesh rajamani
<ra...@gmail.com>wrote:

> Sorry I just realized the table name in 2 schema are slightly different,
> but still i am not sure why i should not use same index name across
> different schema. Below is the instruction to reproduce.
>
>
> Created 2 keyspace using cassandra-cli
>
>
> [default@unknown] create keyspace keyspace1 with placement_strategy =
> 'org.apache.cassandra.locator.SimpleStrategy' and
> strategy_options={replication_factor:1};
>
> [default@unknown] create keyspace keyspace2 with placement_strategy =
> 'org.apache.cassandra.locator.SimpleStrategy' and
> strategy_options={replication_factor:1};
>
>
> Create table index using cqlsh as below:
>
>
> cqlsh> use keyspace1;
>
> cqlsh:keyspace1> CREATE TABLE table1 (version text, flag boolean, primary
> key (version));
>
> cqlsh:keyspace1> create index sversionindex on table1(flag);
>
> cqlsh:keyspace1> use keyspace2;
>
> cqlsh:keyspace2> CREATE TABLE table2 (version text, flag boolean, primary
> key (version));
>
> cqlsh:keyspace2> create index sversionindex on table2(flag);
>
> *Bad Request: Duplicate index name sversionindex*
>
>

Since index name is optional in the create index statement, you could just
omit it and let the system give it a unique name for you.

-Bryan

Re: Index with same Name but different keyspace

Posted by mahesh rajamani <ra...@gmail.com>.
Sorry I just realized the table name in 2 schema are slightly different,
but still i am not sure why i should not use same index name across
different schema. Below is the instruction to reproduce.


Created 2 keyspace using cassandra-cli


[default@unknown] create keyspace keyspace1 with placement_strategy =
'org.apache.cassandra.locator.SimpleStrategy' and
strategy_options={replication_factor:1};

[default@unknown] create keyspace keyspace2 with placement_strategy =
'org.apache.cassandra.locator.SimpleStrategy' and
strategy_options={replication_factor:1};


Create table index using cqlsh as below:


cqlsh> use keyspace1;

cqlsh:keyspace1> CREATE TABLE table1 (version text, flag boolean, primary
key (version));

cqlsh:keyspace1> create index sversionindex on table1(flag);

cqlsh:keyspace1> use keyspace2;

cqlsh:keyspace2> CREATE TABLE table2 (version text, flag boolean, primary
key (version));

cqlsh:keyspace2> create index sversionindex on table2(flag);

*Bad Request: Duplicate index name sversionindex*

*Thanks*
*Mahesh*





On Sat, May 17, 2014 at 3:11 AM, Mark Reddy <ma...@boxever.com> wrote:

> Can you share your schema and the commands you are running?
>
>
> On Thu, May 15, 2014 at 7:54 PM, mahesh rajamani <
> rajamani.mahesh@gmail.com> wrote:
>
>> Hi,
>>
>> I am using Cassandra 2.0.5 version. I trying to setup 2 keyspace with
>> same tables for different testing. While creating index on the tables, I
>> realized I am not able to use the same index name  though the tables are in
>> different keyspaces. Is maintaining unique index name across keyspace is
>> must/feature?
>>
>> --
>> Regards,
>> Mahesh Rajamani
>>
>
>


-- 
Regards,
Mahesh Rajamani

Re: Index with same Name but different keyspace

Posted by Mark Reddy <ma...@boxever.com>.
Can you share your schema and the commands you are running?


On Thu, May 15, 2014 at 7:54 PM, mahesh rajamani
<ra...@gmail.com>wrote:

> Hi,
>
> I am using Cassandra 2.0.5 version. I trying to setup 2 keyspace with same
> tables for different testing. While creating index on the tables, I
> realized I am not able to use the same index name  though the tables are in
> different keyspaces. Is maintaining unique index name across keyspace is
> must/feature?
>
> --
> Regards,
> Mahesh Rajamani
>