Loading presentation...

Present Remotely

Send the link below via email or IM


Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in the manual

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.


Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Why is my MongoDB slow?

No description

Pradip Hudekar

on 9 December 2014

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Why is my MongoDB slow?

Why is my MongoDB slow?
I have heard of a cool DB!!
It is too fast..
It is a document store
It is just like RDBMS
I think collections are like tables
You can do joins too
It is very easy to scale with sharding
Wow, replica sets will make sure my data is always safe
It all seems to work fine...
God's gift to Mankind
It is time to go LIVE
DB is taking long time to respond
Why can't I see updated profile?
Looks like some of the data is lost
Something is Wrong
I think MongoDB SUCKS
It is all MongoDB's fault
what is MongoDB?
A BSON Document Database
: "James",
: "Bond",
: true,
: 35,
: [ "girls", "guns" ],
: [
: "SkyFall",
: 2012,
Simple to use
: "Bond"})
MongoDB is not solution to all DB Problems
Easy installation and setup
Easy to work with
MongoDB is certainly best choice in some of the scenarios
How would I know If I can use it?
Does your data fits document model?
Do you need transactions?
Do you need real time aggregation for reporting?
Are your queries well defined?
Focus on Schema
MongoDB is not schema less, it has flexible schema
Think about denormalization
Keep in mind the document size limit (16 MB)
Support for maximum 100 Nested Documents
References can be used as exceptions
Example of an ideal Schema
: "Lagaan",
: "Ashutosh Gowarikar",
: 2001,
: 8.1,
: true,
: [
"Aamir Khan",
"Gracy Singh" ,
"Rachel Shelley"],
: [
: "A must see for all Indian cricket fans!",
: ISODate("10-08-2002"),
: "Very good movie.."
: 9.0
Why do I need them?
Faster Reads
Faster Updates
Faster Deletes
Maintaining Unique Keys
Improving Sharding
Various Indexes in MongoDB
Creating index
: 1});
Default Index
: 1,
: {
: 1

: "<db>.<collection>",

: "_id_"
Single Field Index
: 1})
Compound Index
: 1,
: -1
Multikey Index
: 1 })
Other Indexes
Geo spatial Indexes
Text Index
Hashed Index
: 1}, {
: true})
Getting indexes
Deleting indexes
: 1})
Index Creation Options
: -1})
Remove Duplicates
: 1},
: true,
: true
Sparse Index
: 1}, {
: true})
Named Index
: 1 ,
: 1 },
: "locality"})
Unique Index
Improving Sorting
Providing a Hint
Index Selectivity
Suggesting an index to use
Sparse indexes in hint can give wrong results
Sparse Ahead
Makes more sense in Compound Index
Filter most of the data using Index
How to detect slow queries
Default logging
Profiling levels
0 - No Profiling
1 - Only slow operations
2 - All operations
How to be sure?
ExperTalks - November 2013
Full transcript