Cannot create index

I tried to create index on command line, and it replies OK.

> CREATE INDEX my_idx ON ON my_ns.my_set (my_bin) STRING
OK, 1 index added.

But after that, I checked the indexes, there is no index.

> show indexes my_ns
0 rows in set (0.000 secs)

What can be the cause of this?

I do notice that there are 2 "ON"s in the statement, but I don’t think that is the issue here. There are a few possibilities:

  1. When an index is created it may take some time to build. Until it is finished, the index will not return any results. It will result in an “Index not active” error. So this is not likely your case.
  2. If you created the index using a specific type (you have “STRING” in your example), but the data in the bin (my_bin) is not a string, the record will not be indexed. Note here that in Aerospike, it is possible for different records to have different types for the same bin.
  3. You should check to see that there are records in the set you are indexing. It is possible that the data are simply in another set or the set has not been used.

Also, please let us know which version you are using. If there is a bug, we will want to check on proper branch.

Thanks for your question

Thank you for the reply.

I m using Aerospike 3. I just wonder it caused by the memory? Because it sometimes creates indexes, and sometimes doesn’t. But I don’t know yet what makes different result.

Can you specify the exact version? It should be available in the logs, which defaults to /var/log/aerospike/aerospike.log.

Also, if you can give us some examples of the data (with types).

Thanks.

I also can not create index because following error occured: Create index failed: FAIL:206:System already has maximum number of indexes, cannot create new index

I checked total count of indexes. There are 256 indices only. Max count of index is 256?

In Aerospike document, it depends only memory. But my memory is sufficient enough. This error occured on aerospike community 3.2, 3.4, 3.5.

This is server side limit. Aerospike currently supports maximum upto 256 secondary indexes …

– R

Dear Raj, Thank you very much! This limit is only for community edition?

I want to clarify following. it is observed that 256 indices per namespaces. Is it right?

Yes !! And limit is same for both Community and Enterprise.

The reason for this limit is knowing limit upfront certain things can be simplified server side. Can you please explain the use case where you need >256 indexes …

– R

We sort and paginate data which returned by UDF (query with multiple filters). To do this

  1. Filter using UDF (query with multiple filters)
  2. In client side, sort all records which returned by UDF in 1st step We tried sorting in UDF using lua. But it was not ordered correctly because unknown run time error
    occured when 2 nodes was running.
  3. In client side, paginate sorted records.

Recently performance was down caused by data increasing. So, we divided some tables using customer id. (some_table=> some_table1, … some_tableN. Here 1~N is customer id). It is like as partition in RDB. But new problem raised: com.aerospike.client.AerospikeException: Create index failed: FAIL:206:System already has maximum number of indexes, cannot create new index

We sort and paginate data which returned by UDF (query with multiple filters). To do this

  1. Filter using UDF (query with multiple filters)
  2. In client side, sort all records which returned by UDF in 1st step We tried sorting in UDF using lua. But it was not ordered correctly because unknown run time error occured when 2 nodes was running.
  3. In client side, paginate sorted records.

Recently performance was down caused by data increasing. So, we divided some tables using customer id. (some_table=> some_table1, … some_tableN. Here 1~N is customer id). It is like as partition in RDB. But new problem raised: com.aerospike.client.AerospikeException: Create index failed: FAIL:206:System already has maximum number of indexes, cannot create new index

Bazor,

Currently there is not plan for increasing limit. I have been thinking about how to get around this problem.

Fundamental idea of need to partition data to get lesser row per selection can be achieved by logical partitioning data and create secondary index over each piece. This is what I believe you have been trying to do.

Alternative method could be creating secondary key such that query itself can filter some data which is not needed. E.g If you are working with string index and your key looks like abc. You can prepend it with id id_abc. Similarly for integer …

HTH – R