question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with secondary indexes

See original GitHub issue

Hello, I’m using Ottoman.js v2.2.0. I have a few models with different types of indexes. When I start the application (which calls await ottoman.start() I see the following issues:

  1. I have the following index on a few models, however the index is created only for the first one:
mySchema.index.findById = {
  by: '_id',
  type: 'n1ql'
};
image
  1. On the CB Admin UI I don’t see refdoc indexes, defined like this:
mySchema.index.findByTest = {
  by: 'test',
  type: 'refdoc'
};
  1. All index names are prefixed by __default__default. I guess that’s the collection name + scope name, but is there a way to specify a custom name for an index? (I couldn’t find any prop with TS autocomplete) image

  2. There’s a default index being created with some strange name. Why is it created and why does it have such a name? image

  3. I see the following output when debug mode is enabled. Seems it tries to create the default index for each of the models (I have 7 models, so the first one is succeeded and 6 are failed). Also instead of seeing the other index names, it outputs just undefineds. image

  4. I created two indexes: one based on field A and field B and another one based on field A only, like the following:

/* first index */
mySchema.index.findByAandB = {
  by: ['A', 'B'],
  type: 'n1ql'
};

/* second index */
mySchema.index.findByA = {
  by: 'A',
  type: 'n1ql'
};

When I run a query like this: select * from test_bucket where A="test", the Advice tab shows that the second index has been used (which is correct).

When I run the following query: select * from test_bucket where A="test" and B="test", the Advice tab shows that the first index has been used (also correct).

However, when I run the first query again after the second one, it always shows that the first index is being used although there’s no condition on field B in the query.

Thanks

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
kishmiryan-karlencommented, May 18, 2022

@gsi-alejandro thanks a lot!

0reactions
gsi-alejandrocommented, May 16, 2022

@kishmiryan-karlen the next release will be this week or the next one.

By the way, I already fixed these issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cassandra at Scale: The Problem with Secondary Indexes
When implementing denormalized indexes, there are three major considerations: data integrity, efficiency, and usability. Data Integrity and ...
Read more >
Best practices for using secondary indexes in DynamoDB
Secondary indexes are often essential to support the query patterns that your application requires. At the same time, overusing secondary indexes or using ......
Read more >
Problem with Secondary Index | SAP Community
I have one performance improvement issue . For that I created non-unique secondary Index (and adjuted the same in SE 14 ) on...
Read more >
Troubleshooting Secondary Indexes
Describes how to debug and troubleshoot usage of secondary indexes. The following table lists problems you may encounter when using secondary indexes.
Read more >
The wrong way to scale up Cassandra DB when secondary ...
Secondary indexes are NOT A PART of a partition key, and Cassandra knows about where your data are living through the partition key....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found