[MDEV-30032] EXPLAIN FORMAT=JSON output: print costs Created: 2022-11-18  Updated: 2023-02-03  Resolved: 2022-11-26

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: None


 Description   

EXPLAIN FORMAT=JSON should print information about the costs.

ANALYZE FORMAT=JSON should have it,too. Ideally, one should be able to compare r_total_time_ms with the cost and see the discrepancy.

And this should work for every node in the query plan.

Obstacles on the way to implementing this vision:

  • For some kinds of subqueries, we do not know how many times they will be executed. We optimize as if the subquery is to be executed once.
  • We don't compute the total cost of some constructs e.g. the cost of UNION [ALL] being cost of its members plus cost of the union operation.

So, starting small:

At least, print the cost of computing the SELECT. For selects with r_loops=1 (e.g. for the top-level one), one will be able to compare it with r_total_time_ms.

Also, print total cost of reading each table.



 Comments   
Comment by Sergei Petrunia [ 2022-11-26 ]

Fixed in bb-11.0 tree

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