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
1
vote
0 answers

Implementing a high-level method for querying DynamoDb by secondary index hashkey

For reading an item by the primary index key, we can simply use the IDynamoDbContext.LoadAsync(key, ...) method. Reading by the secondary key is much less ergonomic. Looking at the options, it seems this functionality is not exposed through…
twinlakes
  • 9,438
  • 6
  • 31
  • 42
1
vote
1 answer

GIN-like index in Couchbase

As I saw in Couchbase documentation it's possible to create an index for the particular fields of a document: https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/createindex.html CREATE INDEX country_idx ON…
Sogawa-sps
  • 147
  • 10
1
vote
0 answers

How do relational databases perform ORDER BY on multiple columns with secondary indices?

I'm trying to understand the sorting algorithm behind SQL ORDER BY clauses in the case that the properties are indexed. Secondary indices are usually implemented as B+ Trees with a combined key, consisting of the indexed value and the associated…
Martin Häusler
  • 6,544
  • 8
  • 39
  • 66
1
vote
1 answer

Dynamo DB ERD for Chat application

I am trying to migrate my chat application from Firestore to DynamoDB. Currently I have 2 collections in firebase: Rooms and Users. Users collection have all roomsIds the user is part of. Rooms collection have some meta data such as name, icon etc.…
1
vote
2 answers

How to use multikey or secondary index in Redis cache?

I need to use two key values in Redis cache so that I can retrieve based on one Key? Kindly help on this, Both keys would be string, and the value will be an entity where the key values will also be present. Example: : json…
1
vote
0 answers

N1QL query works even with missing predicate created using couchbase secondary index

I have created a secondary index in couchbase: CREATE INDEX `data` ON `bucket`(`field1`,`field2`,`field3`, lower(`field4`)) WHERE (`field5` = "CONSTANT") When I execute this query on couchbase: select document.* from bucket AS document WHERE…
1
vote
1 answer

Secondary in-memory index representations in Python

I am searching for an efficient solution to build a secondary in-memory index in Python using a high-level optimised mathematical package such as numpy and arrow. I am excluding pandas for performance reasons. Definition "A secondary index contains…
Athanassios
  • 206
  • 1
  • 10
1
vote
1 answer

why wouldn't Cassandra allow querying/filtering on columns without secondary indices even when primary key is specified

Before creating an Cassandra improvement ticket, I am curious what is the technical limitation to not allow column querying without secondary indices on them even when entire Primary Key (partition_key and clustering_key) is specified? With the PK,…
kisna
  • 2,869
  • 1
  • 25
  • 30
1
vote
1 answer

Secondary index support in Cassandra?

At blog I see below statement Secondary Indexes Secondary indexes are a first-class construct in MongoDB. This makes it easy to index any property of an object stored in MongoDB even if it is nested. This makes it really easy to query based on…
emilly
  • 10,060
  • 33
  • 97
  • 172
1
vote
0 answers

Is it possible in Apache Phoenix to create a functional index on an UDF that uses as arguments columns from two different tables?

We need to execute geo-spatial queries where we use geo-spatial functions that operate on columns from two different tables (YELLOW_TAXI_TRIPS, TAXI_ZONES). The UDF works as a comparison to join the two tables. Below is the query in which we want to…
1
vote
2 answers

Why can't direct routing be used for distributed data with a secondary index?

I'm reading the following article: Elements of Scale: Composing and Scaling Data platforms I'm stuck on understanding the following sentences: A secondary index is an index that isn’t on the primary key. This means the data will not be partitioned…
1
vote
1 answer

RethinkDB's multi-indexes on nested field

I have a table with this document: { "autoroles": [ { "id": "305372902679642113", "users": [ "262700032262799382", "166597257381150720", "149505704569339904", …
Zoddo
  • 163
  • 6
1
vote
1 answer

how to create spaces in tarantool searchable on multiple criteria

Our use case is as below We will be getting articles from a source. Each article has certain metadata.The metadata has a field categories which is a list of category names(mobiles,laptops etc) that the article might fall into.Similarly the metadata…
crackerplace
  • 5,305
  • 8
  • 34
  • 42
1
vote
1 answer

Secondary index missing records after migration (add/remove node)

I have noticed that whenever i add/remove nodes from my cluster, secondary index query returns empty result for some records even after migration completes. However they can be successfully retrieved using PK. I am using version 3.8.1 with RAM+HDD…
Nishant Kumar
  • 2,199
  • 2
  • 22
  • 43
1
vote
0 answers

Creating compound index in rethink DB

I doing a query in rethink db, r.db('main').table('log').distinct({index: 'number'}).between(r.epochTime((new Date).setHours(0, 0, 0, 0)/1000), r.epochTime((new Date).setHours(23, 59, 59, 99)/1000), {index: 'createdAt'}).count() number and…
Jitesh Tukadiya
  • 1,269
  • 1
  • 11
  • 25
1 2 3
8 9