Cassandra: secondary indexes for queries with multiple WHERE clauses
Date : March 29 2020, 07:55 AM
should help you out If most of your queries on albums and titles will come with a condition on artist, then I would say a single secondary index on artist would be sufficient since an artist is less likely to have more than a hundred albums. In this case, queries having an EQ on artist are very selective. If many of your queries might solely on albums and titles without identifying an artist, then I would say building three secondary indices is necessary.
|
Creating secondary indexes in RethinkDB (javascript) not working as in doc
Date : March 29 2020, 07:55 AM
should help you out You can use r.row in un-nested queries like the example in the docs, but for nested queries you need to use an actual function. When you put the indexCreate inside a do it became part of a nested query. If instead of r.table('someTable').indexCreate("indexName", [r.row("field1"), r.row("field2")]) you write r.table('someTable').indexCreate('indexName', function(row) { return [row('field1'), row('field2')]; }) in your query it should work.
|
How to use regex in secondary indexes on rethinkdb?
Date : March 29 2020, 07:55 AM
it helps some times What you want is more suitable for another database with full text search support like ElasticSearch. Have a looks in this article: https://www.rethinkdb.com/docs/elasticsearch/RethinkDB doesn't have any capabilities to do full text search on an index, or apply arbitrary on index. It's quite limited to what kind of operation can be done on index such as getAll, between.
|
How to maintain ACID transaction in mongodb documents connected by ref schema
Date : March 29 2020, 07:55 AM
To fix this issue Not sure what you are asking, but, as stated in the documentation, there are no multi-document transactions in mongodb. So the answer is: "you can't do any multi-document transactions". Your client technology is irrelevant.
|
DynamoDB queries on secondary index, how to define the indexes
Date : March 29 2020, 07:55 AM
help you fix your problem The reason it isn't working is that the keys in a Local Secondary Index must have the same partition key as the table. So in your case, your Local Secondary Indexes must have messageId as its HASH key and room and userId as RANGE keys on their respective indexes. And since your table is already keyed by (messageId, userId) then you don't need the userId Local Secondary Index. This setup would technically work: MessagesDynamoDBTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: messageId
AttributeType: S
- AttributeName: room
AttributeType: S
- AttributeName: userId
AttributeType: S
KeySchema:
- AttributeName: messageId
KeyType: HASH
- AttributeName: userId
KeyType: RANGE
LocalSecondaryIndexes:
- IndexName: roomIndex
KeySchema:
- AttributeName: messageId
KeyType: HASH
- AttributeName: room
KeyType: RANGE
Projection:
ProjectionType: KEYS_ONLY
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:custom.tableName}
MessagesDynamoDBTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: messageId
AttributeType: S
- AttributeName: room
AttributeType: S
- AttributeName: userId
AttributeType: S
KeySchema:
- AttributeName: messageId
KeyType: HASH
GlobalSecondaryIndexes:
- IndexName: roomIndex
KeySchema:
- AttributeName: room
KeyType: HASH
Projection:
ProjectionType: KEYS_ONLY
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
- IndexName: userIndex
KeySchema:
- AttributeName: userId
KeyType: HASH
Projection:
ProjectionType: KEYS_ONLY
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:custom.tableName}
|