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

Postgres compound index effectiveness with a given column list

Let's say I have a compound index involving these 3 columns. (name, email, phone) Is this index still will be used for these queries? The first query involves just 2 of indexed fields and the second index using more then all of the fields. By the…
gozluklu_marti
  • 79
  • 1
  • 7
  • 26
0
votes
2 answers

What is compound indexing and how do I use it properly?

I have a really slow query that repeats itself quite a bit. I've tried indexing the individual fields but it doesn't seem to help. The CPU usage is still very high and the queries still appear on the slow query log. It seems I need a compound…
Quesofat
  • 1,493
  • 2
  • 21
  • 49
0
votes
1 answer

Do I need single column indexing if have compound indexing in rails?

I have created a table in rails with PostgreSQL, it's a join table between account and program, what the best way to add the index? Do I need the single indexing index: true for each reference when I have both order of compound…
Stephen
  • 3,822
  • 2
  • 25
  • 45
0
votes
0 answers

Making two fields compound index in mongoDb and update the document

I'm using mongoDb in our project and got stuck at a point. I'm using bulkOperation of mongoDb to save a list of Objects. I need to make two fields (mac and gatewaytime ) as a compound index on a collection that make up an unique combination for…
0
votes
1 answer

Mongo - query not matching index

I'm trying to set my collections indexes correctly. I've a collection that is like: // videos collection { _id: idString, ts: date, owner_id: idString, published: boolean, readyToPlay: boolean, private: boolean, deleted:…
Guig
  • 9,891
  • 7
  • 64
  • 126
0
votes
1 answer

MongoDB: Compound Indexes on a "Where"-Select

I have the following MongoDB schema: mandate: { type: mongo.Schema.Types.ObjectId, ref: 'Mandate', required: true }, observer: { type: mongo.Schema.Types.ObjectId, ref: 'Observer', required: true }, value: { …
Eric
  • 115
  • 1
  • 10
0
votes
1 answer

Key length for Compound index

I'm looking to upgrade a MongoDB 2.4.x instance to 2.6. As part of this process I ran the db.upgradeCheckAllDBs() method to ensure my data is in a correct state for the upgrade. This check found a number of records in my database for which there…
Adam Parkin
  • 17,891
  • 17
  • 66
  • 87
0
votes
3 answers

Optimization of query using covering indices

I have the following query with a subquery and self join: SELECT bucket.patient_sid AS sid FROM (SELECT clinical_data.patient_sid, clinical_data.lft, clinical_data.rgt FROM clinical_data INNER JOIN (SELECT…
horcle_buzz
  • 2,101
  • 3
  • 30
  • 59
0
votes
1 answer

How to store Incremental Data in MongoDB?

I have millions of documents in various collection. My application has to periodically update some incremental data to MongoDB. How do I acheive this? For every record in incremental data, if the record exists it must be updated with new values…
Kavitha Madhavaraj
  • 562
  • 1
  • 6
  • 23
0
votes
1 answer

Indexing OR AND queries MongoDB

I have a requests table within my database which consists of a few fields such as "pending" to denote if a request has not been serviced, "expiry" to keep a track of the expiry time in milliseconds (Epoch), "count" which counts down to 0 every time…
0
votes
1 answer

RethinkDB index query with several .contains()

I have the following query that works fine but is slow, however I can't figure out how to index it properly: r.db('my_db') .table('messages') .filter({ community_id : community.id}) .filter(function(row){ return…
jesperado
  • 25
  • 3
0
votes
2 answers

Add a compound index when some fields can be null or arrays of strings

I have a mongodb collection. { "p1": "V1", "p2": ["V2","V3","V4"], "p3": ["V5","V6","V7"], "p4": "V8" } I want to create an index on fields p1, p2, p3. My documents may not have p2 or p3. How should I create my index?
mukulbudania
  • 181
  • 1
  • 1
  • 5
0
votes
2 answers

MongoDB multiple compound indexing will affect performance?

Is creating multiple compound indexes for serving various types of queries is better? or Is it better to use a single compound index in a way that supports multiple queries(which is hard to analysis and construct, since there are many number of…
excitepv
  • 31
  • 6
0
votes
1 answer

Compound index with lodash/underscore

When working with data from database, we often get arrays of stuff that, due to database constraints, can be (uniquely) indexed by compound indices. However, indexBy does not seem to work for compound indices, or does it? Given an array x with…
Domi
  • 22,151
  • 15
  • 92
  • 122
0
votes
1 answer

Query compound _id for time range in MongoDB using PyMongo

I have a collection in which the _ids are compound of a time and an string (yeah, I know it's bad but... it was like that when I arrived). One record in that collection looks like: { "_id": { "my_string": "Foo", "my_time": new…
Savir
  • 17,568
  • 15
  • 82
  • 136