Chapter 3: Slow Queries Lab: Analyse Profiler Data

Do we need to create index manually or it is already created?

@ ashokshet

Umm… the index was created on a database.collection that you don’t have, and the results were captured in the system.profiler collection that you do have. So, no, you don’t have to create an index; what you need to do is analyze the profiler data to determine what the index was and when it was put into action. HTH. Good luck.

1 Like

For this question analyst Profiler Data: I found the answer in a roundabout way by doing lot of grep command after dumping the data into a text file. I am not satisfied the way I found the answer. My intuition says, we need to use the compass, but do not know how use it. Is there any easy method to find the answer?

@ Arivoli_48247

Well, considering that this is a class to teach you about using MongoDB tools to solve problems, I wouldn’t be very happy about your solution either. However, I would not recommend trying to use Compass for this task.

Instead, use the mongo shell and craft some reasonable queries on the profiling data – I’m assuming here that you have loaded the profile.json file into a collection in your VM – and then find the answer that way.

I am using queries such as below and not seeing anything.
Should we be using normal profiler queries?


i have figured this out now.
Its one of the less obvious labs.
Maybe thats the way its meant to be but I was confused there was no script so maybe it needs a little rewording.

1 Like

I would agree, this was an incredibly confusing lab. Bottom line is, you’re importing someone else’s system profiler data. So, all the queries that you would normally use db.system.profile.find(XXX) to query the profiler data, you would substitute with db.profiler_data.find(XXX). You can use these queries to determine when and which index was created.
Also, I did use Compass to figure out the profiler schema so I knew what to query. If you’re familiar with the profiler data you wouldn’t need to this.


@Lisa_43494, @jpowellsdak

Keep in mind that running the system profiler is a very expensive proposition, and is almost never done for any length of time on a production system. Generally, in “real life”, you would do exactly what was done here – select a time (hopefully :wink:) when the system is not being used too much, to run system tests, then run the profiler for a time, save the resulting data, and then turn profiling off. Then you’d do your analysis without impacting the production system.

For example, one of my recent clients has a system with production users in two time zones in the US, with a development team in India, and associates in London. Let me tell you that finding a suitable time to run tests if you need production data was a real challenge! HTH.

1 Like

I was able to find out the index name. The problem I am facing is to find the time it was created. Looking at the data, I am able to get the time using this:

Is this correct? What does query.getMore mean in this case? Index build?


There’s a little blurb about getMore in the profiler doc. And as you can see from the blurb, a getMore operation doesn’t necessarily have any bearing on this.

PS: Posting potential lab answers is against forum guidelines. Suggest you delete the find() command from your post.

I have removed the command

You’re on the right track. Removing getMore will yield the same result.