Duplicate Workers entries in some EXPLAIN plans - Mailing list pgsql-bugs

From Maciek Sakrejda
Subject Duplicate Workers entries in some EXPLAIN plans
Date
Msg-id CADXhmgSr807j2Pc9aUjW2JOzOBe3FeYnQBe_f9U+-Mm4b1HRUw@mail.gmail.com
Whole thread Raw
Responses Re: Duplicate Workers entries in some EXPLAIN plans
List pgsql-bugs
Hello,

I ran into an odd behavior with some EXPLAIN results in Postgres 11.5. I noticed this with JSON format first, but similar issues exist with the other formats as well for this query. I think I can follow up with the query and full plan if needed, but essentially, the issue is that the Sort node has two different entries for the "Workers" key (something that technically JSON does allow, but such JSON structures are very difficult to work with, and JSON library support for them is poor). The node looks like this (some details elided):

{
  "Node Type": "Sort",
  ...
  "Workers": [
    {
      "Worker Number": 0,
      "Sort Method": "external merge",
      "Sort Space Used": 20128,
      "Sort Space Type": "Disk"
    },
    {
      "Worker Number": 1,
      "Sort Method": "external merge",
      "Sort Space Used": 20128,
      "Sort Space Type": "Disk"
    }
  ],
  ...
  "Workers": [
    {
      "Worker Number": 0,
      "Actual Startup Time": 309.726,
      "Actual Total Time": 310.179,
      "Actual Rows": 4128,
      "Actual Loops": 1,
      "Shared Hit Blocks": 2872,
      "Shared Read Blocks": 7584,
      "Shared Dirtied Blocks": 0,
      "Shared Written Blocks": 0,
      "Local Hit Blocks": 0,
      "Local Read Blocks": 0,
      "Local Dirtied Blocks": 0,
      "Local Written Blocks": 0,
      "Temp Read Blocks": 490,
      "Temp Written Blocks": 2529
    },
    {
      "Worker Number": 1,
      "Actual Startup Time": 306.523,
      "Actual Total Time": 307.001,
      "Actual Rows": 4128,
      "Actual Loops": 1,
      "Shared Hit Blocks": 3356,
      "Shared Read Blocks": 7100,
      "Shared Dirtied Blocks": 0,
      "Shared Written Blocks": 0,
      "Local Hit Blocks": 0,
      "Local Read Blocks": 0,
      "Local Dirtied Blocks": 0,
      "Local Written Blocks": 0,
      "Temp Read Blocks": 490,
      "Temp Written Blocks": 2529
    }
  ],
  "Plans:" ...
}

YAML and XML formats both have parallel issues. TEXT format is a little different but also seems odd, with multiple lines in the plan node for each worker:

  Sort Method: external merge  Disk: 4920kB
  Worker 0:  Sort Method: external merge  Disk: 5880kB
  Worker 1:  Sort Method: external merge  Disk: 5920kB
  Buffers: shared hit=682 read=10188, temp read=1415 written=2101
  Worker 0: actual time=130.058..130.324 rows=1324 loops=1
    Buffers: shared hit=337 read=3489, temp read=505 written=739
  Worker 1: actual time=130.273..130.512 rows=1297 loops=1
    Buffers: shared hit=345 read=3507, temp read=505 written=744

Is this a bug?

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #16060: JDBC - badly gets DateOffsetTime value from database
Next
From: Michael Paquier
Date:
Subject: Re: BUG #16060: JDBC - badly gets DateOffsetTime value from database