Questions tagged [secondary-indexes]

an index which is created other than index based on primary key, to speed up processing.

Indexing of secondary keys can only be done when the key is ordered. An index file stores the position of the record a particular category.

In this example, a secondary key is ordered alphabetically, the first record which starts with b is #14, the first record which starts with c is #26

Index file:                    Database:

Category | Start position      ID | First_name
---------|---------------      ---|-----------
a        | 1                   1  | Aaron
b        | 14                  2  | Abe
c        | 26                  ...
d        | 34                  14 | Barry

A query run on the data will be much faster, instead of looking at every record, the program can skip to start position of the category for the first letter of their name. For example, if this query was run:

SELECT First_name
FROM database
WHERE First_name = "Bryan"

The program would search for barry between records 14 - 25 rather than looking at all the records in the database.

123 questions
4
votes
1 answer

Cassandra CQL range query rejected despite equality operator and secondary index

From the table schema below, I am trying to select all pH readings that are below 5. I have followed these three pieces of advice: Use ALLOW FILTERING Include an equality comparison Create a secondary index on the reading_value column. Here is my…
naomi
  • 1,934
  • 1
  • 14
  • 29
4
votes
3 answers

How do I query DynamoDB2 table by global secondary index only using boto 2.25.0?

This is a continuation** of my quest to switch from regular DynamoDB tables to DynamoDB2 ones with Global Secondary Indices. So I created my table as shown here and then added the following two elements: table.put_item(data={'firstKey': 'key01',…
I Z
  • 5,719
  • 19
  • 53
  • 100
3
votes
1 answer

Creating Secondary Indexes in Cassandra using Thrift and php

I am after any examples of how to create secondary indexes on an new or existing columns in a cassandra db using the Thrift API. The documentation surrounding Thrift is very sparse. Can anyone help a brother out? A second question that I was…
3
votes
1 answer

Query from secondary index on aerospike

I'm considering aerospike for one of our projects. So I currently created a 3 node cluster and loaded some data on it. Sample data ns: imei set:…
ivcode
  • 235
  • 2
  • 14
3
votes
2 answers

AWS Lambda querying secondary index

The following is node.js query in AWS lambda on a dynamoDB JSON object. UserID is the primary key with no sort key. GeoHash is a secondary key, with index name "GeoHash-index". The call succeeds with no error, but does not result in anything being…
3
votes
0 answers

SASI Indexes in Cassandra seem to have some bugs

I just started working with the SASI index on Cassandra 3.7.0 and I encountered a problem which as I suspected was a bug. I had hardly tracked down the situation in which the bug showed up, here is what I found: When querying with a SASI index, it…
Qiuzd
  • 31
  • 3
3
votes
1 answer

Does h2 support creating table with secondary key?

Does h2 support creating table with secondary key? When I try this create table, it fails with "org.h2.jdbc.JdbcSQLException: Unknown data type: "("; SQL statement:" CREATE TABLE IF NOT EXISTS testTable (col1 BIGINT(20) NOT NULL AUTO_INCREMENT, …
Rishi Kesh Dwivedi
  • 643
  • 2
  • 7
  • 15
3
votes
1 answer

High Aerospike latency

In the aerospike set we have four bins userId, adId, timestamp, eventype and the primary key is userId:timestamp. Secondary Index is created on userId to get all the records for a particular user and the resulted records are passed to stream udf. On…
annu
  • 75
  • 6
3
votes
1 answer

performance of using primary key and secondary index in a query in cassandra

Lets say there is a table with 3 columns A,B, and C. A is primary key. I have 2 types of query, one that searches by A and B and another that searches by A and C. Is it better to add a secondary index for C to search based on A and C or make a new…
Navnav
  • 982
  • 3
  • 11
  • 25
3
votes
1 answer

Cassandra query on secondary index is very slow

We have a table with about 40k rows, querying on secondary index is slow(30 seconds on production). Our cassandra is 1.2.8. The table schema is as following: CREATE TABLE usertask ( tid uuid PRIMARY KEY, content text, ts int ) WITH …
user3012568
  • 31
  • 1
  • 3
3
votes
1 answer

Secondary Index in OrientDB

Is there a way to specify a secondary index in OrientDB? I need something that have all the documents references that have a specified field (like indexable=true).
Ammar
  • 5,070
  • 8
  • 28
  • 27
2
votes
1 answer

Improve Couchbase Query for large dataset

I have below bucket in Couchbase I am using inner join to fetch the document We have global secondary index for parent and child document. Total records in bucket : 4,300,000 Query Execution : 5-7 sec RAM Used is 32 GB (allocated 90 GB) Disk Used…
2
votes
1 answer

AWS DynamoDB response size different between CLI and Node SDK

I am trying to optimize my query to dynamodb to return all matching items. From the cli I can query the table and it returns all 303 items. CLI Request: aws dynamodb query --table-name my-table --index-name "myGsi" --key-condition-expression…
Brian Anderson
  • 621
  • 7
  • 22
2
votes
1 answer

DynamoDB: How to query using GSI when you know the partition key but not the sort key?

My table is set up like this PK | SK | CreatedAt (DateTime)(Secondary Global Index) | Random Attributes USER | 0xFF | Today | 1 USER | 0xFE | Yesterday | 2 So my…
2
votes
1 answer

Can I create a secondary index on a UDT field in cassandra?

I have a table with a UDT that stores a user address. Can I index on the country code?
horatius
  • 784
  • 1
  • 12
  • 30
1
2
3
8 9