[MDEV-30059] Optimizer Trace: plan_prefix should be a comma-separated-list, not array. Created: 2022-11-21  Updated: 2023-08-07  Resolved: 2022-11-28

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Fix Version/s: 11.0.0

Type: Task Priority: Major
Reporter: Sergei Petrunia Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: optimizer_trace


 Description   

Optimizer Trace currently prints plan_prefix as an array:

               "plan_prefix": ["t_outer_1", "t_outer_2", "t_inner_1"],

... sometimes auto-formatter puts each array element onto its own line.

This makes it impossible to use grep.

On the other hand, it doesn't seem to be possible to make any use of the JSON array structure: JSON Path language doesn't provide any convenient way for the most common operation of "find this join prefix".

So, the suggestion is to change the representation to be comma-separated list:

                 "plan_prefix": "t_outer_1,t_outer_2,t_inner_1",



 Comments   
Comment by Sergei Golubchik [ 2022-11-25 ]

how is this supposed to be used? mysql -e '...' |grep ... ? could you show one complete (without ...) realistic example?

Comment by Sergei Petrunia [ 2022-11-28 ]

The most common use case is to just locate the place in the trace where we have a join prefix of "t1,t2,t3" and are considering next tables.

Sometimes we're interested in looking at what happened when we were considering adding "t4", sometimes we want to look at all options the optimizer has considered. (This is why the table being added is not in the list).

Comment by Sergei Petrunia [ 2022-11-28 ]

Pushed into bb-11.0 tree.

Generated at Thu Feb 08 10:13:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.