[SERVER-1812] Add the ability to get query results and the query plan in one call Created: 20/Sep/10 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Performance, Querying |
| Affects Version/s: | 1.6.1, 1.7.0 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Justin Dearing | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
All |
||
| Issue Links: |
|
||||||||||||||||||||||||
| Assigned Teams: |
Query Execution
|
||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Description |
|
.explain() on a query returns the query plan instead of the query itself. It would be nice to be able to get the query results and the execution plan. This would be useful from the shell, as well as from the APIs. SQL Server Management Studio, the GUI that comes with MS SQL 2k5/2k8/2k8R2 has this functionality and its very useful when debugging. It allows you to tweak a query and ensure that the result set did not change in addition to measuring performance. |
| Comments |
| Comment by Craig Homa [ 31/Jul/19 ] | |
|
Re-opening as future plans to improve sharded explain will make this an easy and useful improvement to implement. | |
| Comment by Asya Kamsky [ 04/Dec/17 ] | |
|
Closing since as of 3.4 significant amount of information about execution plan is available in the logs. | |
| Comment by Asya Kamsky [ 04/Dec/17 ] | |
|
We now support this since the logs for operations show the number of index keys affected.
This is a log line for single insert into a collection with nine indexes. Note keysInserted:9 field. | |
| Comment by Justin Dearing [ 21/Sep/10 ] | |
|
insert().explain() Would serve several purposes:
| |
| Comment by Eliot Horowitz (Inactive) [ 21/Sep/10 ] | |
|
explains don't really make sense on insert as you know its going to touch every index. | |
| Comment by Justin Dearing [ 21/Sep/10 ] | |
|
Eliot, I'll dig more deeply into what SSMS does. Some things I just noticed now: 1. I can do var foo = db.foo.find() and call explain on that after getting results. So this is already possible. Let me do some more research/thinking about this before closing this ticket. Insert should definitely have an explain to list the indexes it adds, if its getting replicated, etc, etc. Then again how do you get that from an insert that isn't safe? | |
| Comment by Eliot Horowitz (Inactive) [ 21/Sep/10 ] | |
|
Not sure what sql manager is doing - probably just doing the explain and the query separately. |