Changes on explain.depesz.com

Recently got two bug reports:

  • plans with “COSTS OFF" do not parse, and error out (bugreport by Marc Dean Jr)
  • WorkTable Scan is not properly parsed (bugreport by Ivan Vergiliev)

Additionally, I was kinda upset because plans that include trigger calls did not display properly.

All of this has been fixed today:

First, I fixed the bugs. Both were in Pg::Explain library that is used to parse plans. In case you're curious – fixes are in this commit.

Then, I worked on triggers, and “planning time/execution time" information that is printed below plan.

Parsing was done actually earlier, in this commit, but now I added appropriate things to explain.depesz.com code.

Display for WorkTable Scan didn't really change, so there is no point in showing it.

Plans without costs, previously failing to parse, now parse, and look like this.

The final thing, with triggers, and planning/execution time is more complicated.

Let's consider this plan:

Delete on df_scenario  (cost=0.00..1.52 rows=1 width=6) (actual time=0.036..0.036 rows=0 loops=1)
  ->  Seq Scan on df_scenario  (cost=0.00..1.52 rows=1 width=6) (actual time=0.014..0.018 rows=1 loops=1)
        Filter: ((df_scenario_uid)::text = 'f0c383d9-f672-4eb9-917a-db9a802f9e06'::text)
        Rows Removed by Filter: 38
Planning time: 0.057 ms
Trigger for constraint fk_df_usage_2_df_scenario: time=51330.296 calls=1
Trigger for constraint fk_df_usage_archive_2_df_scenario: time=17606.506 calls=1
Trigger for constraint fk_df_scenario_2_df_scenario_audit: time=0.387 calls=1
Trigger for constraint fk_df_scenario_usage_filter_2_df_scenario: time=0.207 calls=1
Trigger for constraint fk_df_rightsholder_discrepancy_2_df_scenario: time=0.164 calls=1
Execution time: 68937.619 ms

with previous code it rendered plan like this:

Please note that:

  • planning/execution time is missing
  • trigger information is missing
  • rows in main table are colorized incorrectly – delete took 0.036 ms, which is not big fraction of total time of 68,937.619 ms

With new code, the same plan renders like this:

Hope you'll find it useful.

2 thoughts on “Changes on explain.depesz.com”

  1. Super excited to hear this! The missing trigger times and planning / execution time been something that bugged me for the past few years, but just worked around it.

  2. Fine! Thank you very much for this work! I constantly use your site.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.