• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Performance tips

 
Georgios Chatziefstratiou
Ranch Hand
Posts: 106
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
i have a mongo db and i have some performance issues takes too long to return results , what i need is just some help on the steps i have to follow to solve this.I am new to mongo but not new in databases.
What i thought think is to do something with indexes then map reduce or something simular .


any help suggestions.I forget to tell i use Hibernate.


thanks
 
Georgios Chatziefstratiou
Ranch Hand
Posts: 106
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Georgios Chatziefstratiou wrote:Hi all
i have a mongo db and i have some performance issues takes too long to return results , what i need is just some help on the steps i have to follow to solve this.I am new to mongo but not new in databases.
What i thought think is to do something with indexes then map reduce or something simular .


any help suggestions.I forget to tell i use Hibernate.


thanks


So i have done a little research and come to that i have to change the index

i have the default index on mongo db and it's like this


correct me if i am wrong

so i was trying to find out how to create my new index and here is what i have so far.





I am not sure about 0 Zeros ?if i have to add the like that but iam not sure about all !

any help Bartender or someone ?



for what i am consider is that on the document maybe i have to declare all other leaves until the final.

For example on the index that i have done above the target is to have faster query when i search from a date to other date.

So the target is the dateinfo i am trying to make the index help my query to get faster dateinfo.

I am not sure if this is ok also what about 0 sometimes is a document and sometimes array.


thanks

 
Georgios Chatziefstratiou
Ranch Hand
Posts: 106
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Georgios Chatziefstratiou wrote:
Georgios Chatziefstratiou wrote:Hi all
i have a mongo db and i have some performance issues takes too long to return results , what i need is just some help on the steps i have to follow to solve this.I am new to mongo but not new in databases.
What i thought think is to do something with indexes then map reduce or something simular .


any help suggestions.I forget to tell i use Hibernate.


thanks


So i have done a little research and come to that i have to change the index

i have the default index on mongo db and it's like this


correct me if i am wrong

so i was trying to find out how to create my new index and here is what i have so far.





I am not sure about 0 Zeros ?if i have to add the like that but iam not sure about all !

any help Bartender or someone ?



for what i am consider is that on the document maybe i have to declare all other leaves until the final.

For example on the index that i have done above the target is to have faster query when i search from a date to other date.

So the target is the dateinfo i am trying to make the index help my query to get faster dateinfo.

I am not sure if this is ok also what about 0 sometimes is a document and sometimes array.


thanks



I have the solution about the index .
Unfortunately this is not the problem.


What else can i do to slve this kind of problem query takes to long to give back results.

any ideas ? Is this forum dead?

 
chris webster
Bartender
Posts: 2407
33
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This forum is not dead, but you haven't really provided enough information for any body to help you much. It's not clear what you are trying to do, what your data looks like or how you are trying to query it.

The default index in MongoDB is on the "_id" field, which is usually an auto-generated identifier (unless you specify otherwise) and this is your primary key. If you are querying by the _id, then this index will help you. But if you are not querying by the _id field, then it will not help you.

Selecting and creating indexes in MongoDB is fairly similar to how you would choose indexes in a relational database i.e. you can have multiple indexes on the same collection, you can have multiple fields in a single index, and you need to ensure that you are querying by the leading portion of a composite index if you want that index to be used in your query. The MongoDB documentation has plenty of material to help you here.

You say you are using Hibernate (presumably with some kind of NoSQL mapping layer?), which means you need to find out what Hibernate is doing with your query as well. If you want to investigate the performance of your queries, I suggest you use the MongoDB shell initially, so you don't have to worry about all this extra Java kruft. Once you have defined a query that performs well in the shell, with the appropriate indexes if necessary, you can put it into your Java code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic