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
0
votes
1 answer

SQL like querying on a DB with more than 1 key in a table

We know that there is the concept of a primary key in traditional RDBMS systems. This primary key is basically used to index records in the table on this particular key for faster retrieval. I know that there are NOSQL stores like Cassandra which…
Abhishek Jain
  • 4,478
  • 8
  • 34
  • 51
-1
votes
1 answer

DynamoDB GSIs query doesn't find GSI3 & GSI4 despite they exist

I am working with DynamoDB and testing queries with boto3 and VS Code at the moment. First i only had 2 GSIs and the queries worked fine. Now i created a third and a fourth one. When trying to query GSI3 and GSI4 i get the following…
-1
votes
1 answer

python nested list sort based on 2nd value of the list is not working properly when it has value 10

here is my code for hackerrank nested list problem in python problem link:https://www.hackerrank.com/challenges/nested-list/problem?isFullScreen=true code: def sort(sub_li): return(sorted(sub_li, key = lambda x: x[1])) if __name__ ==…
1 2 3
8
9