Add EXPLAIN output to views_ui query debug pane

Created on 16 January 2025, 6 days ago

Problem/Motivation

Views can get very complex and then you have slow views and it's hard to debug by copy & pasting to a MySQL instance, running explain and then copying it back.

Proposed resolution

Add EXPLAIN support. All of core's DB engines support "EXPLAIN [query]".

Remaining tasks

- Add basic test coverage

User interface changes

- Add a new "Explain" row
- Add a new explain table

Here is how it looks:

Release notes snippet

📌 Task
Status

Active

Version

11.1 🔥

Component

views_ui.module

Created by

🇩🇪Germany Fabianx

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

  • views

    Involves, uses, or integrates with views. In Drupal 8 core, use the “VDC” tag instead.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Fabianx
  • Merge request !10916Resolve #3500108 "Add explain output" → (Open) created by Fabianx
  • 🇩🇪Germany Fabianx

    Note: There is a bug right now, where views_ui is not correctly replacing the placeholders.

    This is due to the check for the Sql object, which is now a SelectInterface object.

    This MR fixes this as a side effect, but this means this is lacking test coverage.

  • 🇳🇿New Zealand quietone
  • 🇬🇧United Kingdom catch

    One minor nit on the MR otherwise this looks great! Hopefully there's an existing test that almost tests this which we can extend.

  • First commit to issue fork.
  • 🇳🇱Netherlands Lendude Amsterdam

    Added minimal test coverage, about the same as what we have for the other data that is rendered in the preview. Since different databases output very different explain data it seems, actually checking the output might be too much here since we might need to switch by database type, which I don't think we want to do, sounds fragile and excessive.

    On SQLite this seems to output quite a lot of data, do we want to add a toggle for adding 'explain' data, like we have for the other data?

Production build 0.71.5 2024