ES|QL - Planning and query profiling#138400
Closed
carlosdelest wants to merge 20 commits intoelastic:mainfrom
Closed
ES|QL - Planning and query profiling#138400carlosdelest wants to merge 20 commits intoelastic:mainfrom
carlosdelest wants to merge 20 commits intoelastic:mainfrom
Conversation
added 10 commits
November 17, 2025 11:47
…r-profile # Conflicts: # server/src/main/resources/transport/upper_bounds/9.3.csv # x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/ShardContext.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlExecutionInfo.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/DataNodeComputeHandler.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/IndexResolver.java
…r-profile # Conflicts: # server/src/main/resources/transport/upper_bounds/9.3.csv # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlSession.java
Collaborator
|
Hi @carlosdelest, I've created a changelog YAML for you. |
added 9 commits
November 21, 2025 12:10
…file' into non-issue/esql-planner-profile
|
|
||
| /** | ||
| * @param logicalOptimizationNanos Time spent on local logical plan optimization (in nanoseconds) | ||
| * @param physicalOptimizationNanos Time spent on local physical plan optimization (in nanoseconds) |
Contributor
There was a problem hiding this comment.
Do you mind clarifying planNanos as well?
It looks like it includes:
- breakPlanBetweenCoordinatorAndDataNode
- reductionPlan
- plan.collect(LookupJoinExec.class::isInstance)...
All of them should be fairly cheap.
It also looks like it does not include local/physical optimization stages.
Member
Author
There was a problem hiding this comment.
I'm looking at it now - as you say, it's fairly cheap and probably makes no sense as it addresses multiple intermediate operations for planning.
I will remove it as it adds some confusion. Thanks!
Member
Author
|
Closing in favor of individual PRs: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the following information to the ES|QL profiling information:
Planning and planning optimization profiling
Adds planning and optimization timing to the
plansprofile section:{ "plans": [ { "description": "data", "cluster_name": "runTask", "node_name": "runTask-0", "plan": "ExchangeSinkExec...", "plan_nanos": 2792, "logical_optimization_nanos": 466416, "physical_optimization_nanos": 132667 }, { "description": "node_reduce", "cluster_name": "runTask", "node_name": "runTask-0", "plan": "ExchangeSinkExec[[title{f}#30, _score{m}#24],false]\n\\_ProjectExec[[title{f}#30, _score{m}#24]]\n \\_FieldExtractExec[title{f}#30]<[],[]>\n \\_TopNExec[[Order[_score{m}#24,DESC,FIRST]],10[INTEGER],5198]\n \\_ExchangeSourceExec[[_doc{f}#33, _score{m}#24, titleVector{f}#31, tags{f}#32],false]", "plan_nanos": 244584 }, { "description": "final", "cluster_name": "runTask", "node_name": "runTask-0", "plan": "OutputExec[org.elasticsearch.xpack.esql.plugin.ComputeService$$Lambda/0x00000ff8016155d8@10a8116]\n\\_ProjectExec[[title{f}#30, _score{m}#24]]\n \\_TopNExec[[Order[_score{m}#24,DESC,FIRST]],10[INTEGER],1032]\n \\_ExchangeSourceExec[[title{f}#30, _score{m}#24],false]", "plan_nanos": 12416, "logical_optimization_nanos": 807583, "physical_optimization_nanos": 244750 } ] }Query profiling
Adds query profiling information to the
LuceneOperator:Profiling information
{ "profile": { "drivers": [ { "operators": [ { "operator": "LuceneTopNSourceOperator[shards = [vectors:0,vectors:1], maxPageSize = 62, limit = 10, needsScore = true, sorts = [{\"_score\":{\"order\":\"desc\"}}]]", "query_profile": [ { "type": "CachingEnableFilterQuery", "description": "(ConstantScore(tags:java))^0.0", "time_in_nanos": 223935, "breakdown": { "set_min_competitive_score_count": 0, "match_count": 0, "shallow_advance_count": 0, "set_min_competitive_score": 0, "next_doc": 117519, "match": 0, "next_doc_count": 741, "score_count": 0, "compute_max_score_count": 0, "compute_max_score": 0, "advance": 0, "advance_count": 0, "count_weight_count": 0, "score": 0, "build_scorer_count": 2, "create_weight": 7875, "shallow_advance": 0, "count_weight": 0, "create_weight_count": 1, "build_scorer": 98541 }, "children": [ { "type": "TermQuery", "description": "tags:java", "time_in_nanos": 197230, "breakdown": { "set_min_competitive_score_count": 0, "match_count": 0, "shallow_advance_count": 0, "set_min_competitive_score": 0, "next_doc": 97439, "match": 0, "next_doc_count": 741, "score_count": 0, "compute_max_score_count": 0, "compute_max_score": 0, "advance": 0, "advance_count": 0, "count_weight_count": 0, "score": 0, "build_scorer_count": 2, "create_weight": 2625, "shallow_advance": 0, "count_weight": 0, "create_weight_count": 1, "build_scorer": 97166 } } ] }, { "type": "KnnScoreDocQuery", "description": "ScoreAndDocQuery", "time_in_nanos": 8616, "breakdown": { "set_min_competitive_score_count": 0, "match_count": 0, "shallow_advance_count": 0, "set_min_competitive_score": 0, "next_doc": 893, "match": 0, "next_doc_count": 31, "score_count": 30, "compute_max_score_count": 0, "compute_max_score": 0, "advance": 0, "advance_count": 0, "count_weight_count": 0, "score": 5265, "build_scorer_count": 2, "create_weight": 666, "shallow_advance": 0, "count_weight": 0, "create_weight_count": 1, "build_scorer": 1792 } }, { "type": "BooleanQuery", "description": "+ScoreAndDocQuery +tags:java", "time_in_nanos": 444501, "breakdown": { "set_min_competitive_score_count": 0, "match_count": 0, "shallow_advance_count": 0, "set_min_competitive_score": 0, "next_doc": 180418, "match": 0, "next_doc_count": 11, "score_count": 10, "compute_max_score_count": 0, "compute_max_score": 0, "advance": 0, "advance_count": 0, "count_weight_count": 0, "score": 8500, "build_scorer_count": 2, "create_weight": 92166, "shallow_advance": 0, "count_weight": 0, "create_weight_count": 1, "build_scorer": 163417 }, "children": [ { "type": "KnnScoreDocQuery", "description": "ScoreAndDocQuery", "time_in_nanos": 10336, "breakdown": { "set_min_competitive_score_count": 0, "match_count": 0, "shallow_advance_count": 1, "set_min_competitive_score": 0, "next_doc": 0, "match": 0, "next_doc_count": 0, "score_count": 10, "compute_max_score_count": 0, "compute_max_score": 0, "advance": 3291, "advance_count": 11, "count_weight_count": 0, "score": 461, "build_scorer_count": 3, "create_weight": 375, "shallow_advance": 1666, "count_weight": 0, "create_weight_count": 1, "build_scorer": 4543 } }, { "type": "TermQuery", "description": "tags:java", "time_in_nanos": 322043, "breakdown": { "set_min_competitive_score_count": 0, "match_count": 0, "shallow_advance_count": 1, "set_min_competitive_score": 0, "next_doc": 0, "match": 0, "next_doc_count": 0, "score_count": 10, "compute_max_score_count": 0, "compute_max_score": 0, "advance": 162752, "advance_count": 10, "count_weight_count": 0, "score": 4000, "build_scorer_count": 3, "create_weight": 83458, "shallow_advance": 11708, "count_weight": 0, "create_weight_count": 1, "build_scorer": 60125 } } ] } ] } ] } ] } }Field caps timing
Adds timing profile to field_caps request:
{ "profile": { "field_capabilities": { "start_millis": 1763713476849, "stop_millis": 1763713476849, "took_millis": 0, "took_nanos": 597625 } } }