Questions tagged [compound-index]

Indexes with multiple columns in the same one index.

For questions about indexing a database by multiple columns at once.

116 questions
0
votes
1 answer

Mongodb - increasing performance using compound index when pagination

I'm newbie to mongodb and I need help about increasing performance for queries using compound indexes. I am using pagination using "_id" field. Query: db.data.find( {"$or": [ { "cat": "5" }, {"cat": "6" } ] }, {"style": "3"}, …
Jun
  • 3,422
  • 3
  • 28
  • 58
0
votes
1 answer

mongodb compound index and single index performance

Consider the following scenario: 100% of the time my query will include a in the query, and sometimes also b. 90% the query will be: {a:"somevalue"} and 10% it will be {a:"somevalue",b:"somevalue"} What would be the downside to satisfy this with…
dunn less
  • 623
  • 10
  • 26
0
votes
2 answers

MongoDB : reading the index instead of reading documents itself, reduce nscanned objects

In the code below I am querying on the date and sorting by name (it can sound weird that I don't index the date field but I am doing that to avoid sorting in memory that's why I index by name). If I am running an explain I got the following : ->…
scoulomb
  • 630
  • 2
  • 7
  • 19
0
votes
1 answer

Compound GeoSpatial Index in MongoDB is not working as intended

the collection nodesWays has the following indexes: > db.nodesWays.getIndexes() [ { "v" : 1, …
Andre
  • 1,249
  • 1
  • 15
  • 38
0
votes
2 answers

mongodb query should be covered by index but is not

the query: db.myColl.find({"M.ST": "mostrepresentedvalueinthecollection", "M.TS": new Date(2014,2,1)}).explain() explain output : "cursor" : "BtreeCursor M.ST_1_M.TS_1", "isMultiKey" : false, "n" : 587606, "nscannedObjects"…
LaurentH
  • 301
  • 2
  • 10
0
votes
1 answer

Mysql compound index cardinality is not same on all fields

I have created an compound index on mysql, here is the command that i use: create index deliver_aid_sid_rcnt_idx on DELIVER_SM(AID,STATUSID,RETRY_CNT) USING BTREE; The weird is that i got different cardinality value for each field. is that normal? i…
Antonios
  • 190
  • 8
0
votes
1 answer

Compound Index along with Single Index

I have two fields in a document I want to index. One of them is Receive Time, and the other one is Serial Number. I want users to be able to query on Serial Number alone or on both Serial Number and Receive Time. The way I see it, I have two…
claudio
  • 1,465
  • 16
  • 26
0
votes
1 answer

MongoDB sparse Index and Array: too many documents indexed

I have a doubt on MongoDB sparse Index. I have a collection (post) with very little documents (6K the biggest) that could embed a sub-document in this way: { "a": "a-val", "b": "b-val", "meta": { "urls": [ "url1", "url2" ... ], …
Ligio
  • 607
  • 2
  • 7
  • 14
0
votes
1 answer

How to get result faster with MongoDB queries and index

I am running a Rails App and using mongoid. I have created Account as a Mongoid::Document in my rails app. There is large amount of records in account document, I have added compound index to fast the queries. but the performance of the application…
AnitaB
  • 1
  • 1
0
votes
1 answer

mongodb compound index over extending

I have a question regarding compound indexes that i cant seem to find, or maybe just have misunderstood. Lets say i have created a compound index {a:1, b:1, c:1}. This should make according to…
dunn less
  • 623
  • 10
  • 26
-1
votes
1 answer

Could you explain aspect of using Composite MySQL INDEX for multiple INNER JOIN?

The query is SELECT v.value FROM products JOIN products_attributes_options pao ON 1 = 1 AND products.id = pao.product_id JOIN attributes_options ao ON 1 = 1 AND…
123
  • 2,169
  • 3
  • 11
  • 35
1 2 3 4 5 6 7
8