[SERVER-8371] Include sorting information into profile Created: 29/Jan/13  Updated: 09/Jul/16  Resolved: 29/Jan/13

Status: Closed
Project: Core Server
Component/s: Admin
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: drapeko Assignee: Unassigned
Resolution: Done Votes: 0
Labels: admin, profiling
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

system.profile collection


Participants:

 Description   

Hi Mongo,

I am currently writing integration tests for my application. So I wanted to make sure that all queries are appropriately using indexes. My intention was to request all unique queries from system.profile and to run explain plans and see whether indexes used.

This could not be completed, as there is no sorting information in the system.profile however sorting affects indexes. My request to include sorting into system.profile

Thanks



 Comments   
Comment by drapeko [ 29/Jan/13 ]

Ooops! Sorry guys, mongo already has it. It's called orderby inside query. Please close the ticket!

Comment by drapeko [ 29/Jan/13 ]

No! Imagine, you have a users collection. And you have created an index on this collection: user(name, createdAt). Now I would like to find out some users sorted by time. In system.profile the second part of the query (sorting/pagination) won't be saved, however it's very important to understand what sorting operation were used, as it affects the performance and index selection.

So my intention was to create a script that will go through all statements in system.profile and execute explain plans and see whether indexes are used or not. If not, I can automatically catch all new/not reliable queries while executing integration tests.

Comment by Gregor Macadam [ 29/Jan/13 ]

You can use aggregation framework to sort

db.system.profile.aggregate( { $sort : { millis : -1 }})

Is this what you mean?

Generated at Thu Feb 08 03:17:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.