Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mutiple parallel nodes #39

Closed
lrweck opened this issue Sep 3, 2019 · 5 comments · Fixed by #42
Closed

mutiple parallel nodes #39

lrweck opened this issue Sep 3, 2019 · 5 comments · Fixed by #42

Comments

@lrweck
Copy link

lrweck commented Sep 3, 2019

Hi!

During testing I've found that some plans produce thousands of "parallel" nodes. Below is an example:

[
  {
    "Plan": {
      "Node Type": "Nested Loop",
      "Parallel Aware": false,
      "Join Type": "Left",
      "Startup Cost": 1005.16,
      "Total Cost": 79258.07,
      "Plan Rows": 3110,
      "Plan Width": 145,
      "Actual Startup Time": 0.976,
      "Actual Total Time": 2332.500,
      "Actual Rows": 194651,
      "Actual Loops": 1,
      "Output": ["(count(*))", "'CREDIPAR'::text", "'100'::text", "d.devcod", "d.devnom", "d.devcpf", "c.connumcon", "sp.sitpadnom", "(CURRENT_DATE - x_1.conpardatven)", "x_2.retdataca"],
      "Inner Unique": false,
      "Shared Hit Blocks": 3833881,
      "Shared Read Blocks": 0,
      "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": 0,
      "Temp Written Blocks": 0,
      "Plans": [
        {
          "Node Type": "Nested Loop",
          "Parent Relationship": "Outer",
          "Parallel Aware": false,
          "Join Type": "Left",
          "Startup Cost": 1004.59,
          "Total Cost": 73177.88,
          "Plan Rows": 3110,
          "Plan Width": 81,
          "Actual Startup Time": 0.947,
          "Actual Total Time": 1401.639,
          "Actual Rows": 194651,
          "Actual Loops": 1,
          "Output": ["d.devcod", "d.devnom", "d.devcpf", "d.carcod", "c.connumcon", "(count(*))", "x_1.conpardatven", "sp.sitpadnom"],
          "Inner Unique": false,
          "Shared Hit Blocks": 2859866,
          "Shared Read Blocks": 0,
          "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": 0,
          "Temp Written Blocks": 0,
          "Plans": [
            {
              "Node Type": "Nested Loop",
              "Parent Relationship": "Outer",
              "Parallel Aware": false,
              "Join Type": "Left",
              "Startup Cost": 1004.03,
              "Total Cost": 55137.97,
              "Plan Rows": 3110,
              "Plan Width": 85,
              "Actual Startup Time": 0.924,
              "Actual Total Time": 784.674,
              "Actual Rows": 194651,
              "Actual Loops": 1,
              "Output": ["d.devcod", "d.devnom", "d.devcpf", "d.carcod", "c.connumcon", "c.concod", "(count(*))", "sp.sitpadnom"],
              "Inner Unique": false,
              "Shared Hit Blocks": 1885824,
              "Shared Read Blocks": 0,
              "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": 0,
              "Temp Written Blocks": 0,
              "Plans": [
                {
                  "Node Type": "Gather",
                  "Parent Relationship": "Outer",
                  "Parallel Aware": false,
                  "Startup Cost": 1002.35,
                  "Total Cost": 49804.32,
                  "Plan Rows": 3110,
                  "Plan Width": 89,
                  "Actual Startup Time": 0.897,
                  "Actual Total Time": 53.637,
                  "Actual Rows": 194651,
                  "Actual Loops": 1,
                  "Output": ["d.devcod", "d.devnom", "d.devcpf", "d.carcod", "c.connumcon", "c.carcod", "c.devcod", "c.concod", "sp.sitpadnom"],
                  "Workers Planned": 3,
                  "Workers Launched": 3,
                  "Single Copy": false,
                  "Shared Hit Blocks": 955451,
                  "Shared Read Blocks": 0,
                  "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": 0,
                  "Temp Written Blocks": 0,
                  "Plans": [
                    {
                      "Node Type": "Hash Join",
                      "Parent Relationship": "Outer",
                      "Parallel Aware": false,
                      "Join Type": "Left",
                      "Startup Cost": 2.35,
                      "Total Cost": 48493.32,
                      "Plan Rows": 1003,
                      "Plan Width": 89,
                      "Actual Startup Time": 0.254,
                      "Actual Total Time": 196.019,
                      "Actual Rows": 48663,
                      "Actual Loops": 4,
                      "Output": ["d.devcod", "d.devnom", "d.devcpf", "d.carcod", "c.connumcon", "c.carcod", "c.devcod", "c.concod", "sp.sitpadnom"],
                      "Inner Unique": true,
                      "Hash Cond": "(d.devsitcod = sp.sitpadcod)",
                      "Shared Hit Blocks": 955451,
                      "Shared Read Blocks": 0,
                      "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": 0,
                      "Temp Written Blocks": 0,
                      "Workers": [
                        {
                          "Worker Number": 0,
                          "Actual Startup Time": 0.315,
                          "Actual Total Time": 5.059,
                          "Actual Rows": 609,
                          "Actual Loops": 1,
                          "Shared Hit Blocks": 2901,
                          "Shared Read Blocks": 0,
                          "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": 0,
                          "Temp Written Blocks": 0
                        },
                        {
                          "Worker Number": 1,
                          "Actual Startup Time": 0.301,
                          "Actual Total Time": 4.766,
                          "Actual Rows": 609,
                          "Actual Loops": 1,
                          "Shared Hit Blocks": 2868,
                          "Shared Read Blocks": 0,
                          "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": 0,
                          "Temp Written Blocks": 0
                        },
                        {
                          "Worker Number": 2,
                          "Actual Startup Time": 0.320,
                          "Actual Total Time": 771.618,
                          "Actual Rows": 192820,
                          "Actual Loops": 1,
                          "Shared Hit Blocks": 946820,
                          "Shared Read Blocks": 0,
                          "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": 0,
                          "Temp Written Blocks": 0
                        }
                      ],
                      "Plans": [
                        {
                          "Node Type": "Nested Loop",
                          "Parent Relationship": "Outer",
                          "Parallel Aware": false,
                          "Join Type": "Inner",
                          "Startup Cost": 0.99,
                          "Total Cost": 48489.19,
                          "Plan Rows": 1003,
                          "Plan Width": 77,
                          "Actual Startup Time": 0.102,
                          "Actual Total Time": 186.353,
                          "Actual Rows": 48663,
                          "Actual Loops": 4,
                          "Output": ["d.devcod", "d.devnom", "d.devcpf", "d.carcod", "d.devsitcod", "c.connumcon", "c.carcod", "c.devcod", "c.concod"],
                          "Inner Unique": true,
                          "Shared Hit Blocks": 955315,
                          "Shared Read Blocks": 0,
                          "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": 0,
                          "Temp Written Blocks": 0,
                          "Workers": [
                            {
                              "Worker Number": 0,
                              "Actual Startup Time": 0.123,
                              "Actual Total Time": 4.756,
                              "Actual Rows": 609,
                              "Actual Loops": 1,
                              "Shared Hit Blocks": 2856,
                              "Shared Read Blocks": 0,
                              "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": 0,
                              "Temp Written Blocks": 0
                            },
                            {
                              "Worker Number": 1,
                              "Actual Startup Time": 0.118,
                              "Actual Total Time": 4.463,
                              "Actual Rows": 609,
                              "Actual Loops": 1,
                              "Shared Hit Blocks": 2823,
                              "Shared Read Blocks": 0,
                              "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": 0,
                              "Temp Written Blocks": 0
                            },
                            {
                              "Worker Number": 2,
                              "Actual Startup Time": 0.120,
                              "Actual Total Time": 733.757,
                              "Actual Rows": 192820,
                              "Actual Loops": 1,
                              "Shared Hit Blocks": 946775,
                              "Shared Read Blocks": 0,
                              "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": 0,
                              "Temp Written Blocks": 0
                            }
                          ],
                          "Plans": [
                            {
                              "Node Type": "Index Scan",
                              "Parent Relationship": "Outer",
                              "Parallel Aware": true,
                              "Scan Direction": "Forward",
                              "Index Name": "contrato_iu0010",
                              "Relation Name": "contrato",
                              "Schema": "public",
                              "Alias": "c",
                              "Startup Cost": 0.56,
                              "Total Cost": 28412.33,
                              "Plan Rows": 10505,
                              "Plan Width": 31,
                              "Actual Startup Time": 0.039,
                              "Actual Total Time": 52.080,
                              "Actual Rows": 48663,
                              "Actual Loops": 4,
                              "Output": ["c.concod", "c.carcod", "c.devcod", "c.connumcon", "c.procod", "c.filcod", "c.condatcad", "c.condatpredev", "c.connumpar", "c.condadadi", "c.condatinc", "c.conusuinc", "c.condatatu", "c.conusuatu", "c.conborent", "c.connumcar", "c.conati", "c.convalcon", "c.convalconatu", "c.convenmaisantigo", "c.condiamaisantigo", "c.convalsal", "c.convlrent", "c.condatquenov", "c.conid", "c.connovperacr"],
                              "Index Cond": "((c.carcod = 121) AND (c.conati = 0) AND (c.convalsal > '0'::numeric))",
                              "Rows Removed by Index Recheck": 0,
                              "Shared Hit Blocks": 176016,
                              "Shared Read Blocks": 0,
                              "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": 0,
                              "Temp Written Blocks": 0,
                              "Workers": [
                                {
                                  "Worker Number": 0,
                                  "Actual Startup Time": 0.044,
                                  "Actual Total Time": 1.566,
                                  "Actual Rows": 609,
                                  "Actual Loops": 1,
                                  "Shared Hit Blocks": 417,
                                  "Shared Read Blocks": 0,
                                  "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": 0,
                                  "Temp Written Blocks": 0
                                },
                                {
                                  "Worker Number": 1,
                                  "Actual Startup Time": 0.042,
                                  "Actual Total Time": 1.520,
                                  "Actual Rows": 609,
                                  "Actual Loops": 1,
                                  "Shared Hit Blocks": 384,
                                  "Shared Read Blocks": 0,
                                  "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": 0,
                                  "Temp Written Blocks": 0
                                },
                                {
                                  "Worker Number": 2,
                                  "Actual Startup Time": 0.045,
                                  "Actual Total Time": 204.697,
                                  "Actual Rows": 192820,
                                  "Actual Loops": 1,
                                  "Shared Hit Blocks": 174807,
                                  "Shared Read Blocks": 0,
                                  "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": 0,
                                  "Temp Written Blocks": 0
                                }
                              ]
                            },
                            {
                              "Node Type": "Index Scan",
                              "Parent Relationship": "Inner",
                              "Parallel Aware": false,
                              "Scan Direction": "Forward",
                              "Index Name": "devedor_iu0021",
                              "Relation Name": "devedor",
                              "Schema": "public",
                              "Alias": "d",
                              "Startup Cost": 0.43,
                              "Total Cost": 1.91,
                              "Plan Rows": 1,
                              "Plan Width": 46,
                              "Actual Startup Time": 0.002,
                              "Actual Total Time": 0.002,
                              "Actual Rows": 1,
                              "Actual Loops": 194651,
                              "Output": ["d.carcod", "d.devcod", "d.devcpf", "d.devdatnas", "d.devborent", "d.devdatinc", "d.devusuinc", "d.devdatatu", "d.devusuatu", "d.devnom", "d.devid", "d.devultaca", "d.devsal", "d.devsalatu", "d.devvenmaisantigo", "d.devdiamaisantigo", "d.devati", "d.devsitcomcom", "d.devsitcomcod", "d.devdatstatus", "d.devstatus", "d.devultimaremessalinha", "d.devdatultremessa", "d.devultimaremessa", "d.devvenacomaisantigo", "d.devdatadev", "d.devacordo", "d.devretdataca", "d.devretdatage", "d.devretusucod", "d.devusucod", "d.devsitcod", "d.devcadmaisrecente", "d.devcadmaisantigo", "d.devdiamaisrecente", "d.devvenmaisrecente", "d.devretseq", "d.devfase", "d.devvalpar", "d.devdatcal", "d.devdatat", "d.devqtdinc", "d.devdatpridev", "d.devriscod", "d.devultacepor", "d.devultpro", "d.devcodcam"],
                              "Index Cond": "((d.devcod = c.devcod) AND (d.carcod = 121))",
                              "Rows Removed by Index Recheck": 0,
                              "Shared Hit Blocks": 779299,
                              "Shared Read Blocks": 0,
                              "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": 0,
                              "Temp Written Blocks": 0,
                              "Workers": [
                                {
                                  "Worker Number": 0,
                                  "Actual Startup Time": 0.004,
                                  "Actual Total Time": 0.004,
                                  "Actual Rows": 1,
                                  "Actual Loops": 609,
                                  "Shared Hit Blocks": 2439,
                                  "Shared Read Blocks": 0,
                                  "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": 0,
                                  "Temp Written Blocks": 0
                                },
                                {
                                  "Worker Number": 1,
                                  "Actual Startup Time": 0.004,
                                  "Actual Total Time": 0.004,
                                  "Actual Rows": 1,
                                  "Actual Loops": 609,
                                  "Shared Hit Blocks": 2439,
                                  "Shared Read Blocks": 0,
                                  "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": 0,
                                  "Temp Written Blocks": 0
                                },
                                {
                                  "Worker Number": 2,
                                  "Actual Startup Time": 0.002,
                                  "Actual Total Time": 0.002,
                                  "Actual Rows": 1,
                                  "Actual Loops": 192820,
                                  "Shared Hit Blocks": 771968,
                                  "Shared Read Blocks": 0,
                                  "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": 0,
                                  "Temp Written Blocks": 0
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "Node Type": "Hash",
                          "Parent Relationship": "Inner",
                          "Parallel Aware": false,
                          "Startup Cost": 1.16,
                          "Total Cost": 1.16,
                          "Plan Rows": 16,
                          "Plan Width": 16,
                          "Actual Startup Time": 0.028,
                          "Actual Total Time": 0.028,
                          "Actual Rows": 16,
                          "Actual Loops": 4,
                          "Output": ["sp.sitpadnom", "sp.sitpadcod"],
                          "Hash Buckets": 1024,
                          "Original Hash Buckets": 1024,
                          "Hash Batches": 1,
                          "Original Hash Batches": 1,
                          "Peak Memory Usage": 9,
                          "Shared Hit Blocks": 4,
                          "Shared Read Blocks": 0,
                          "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": 0,
                          "Temp Written Blocks": 0,
                          "Workers": [
                            {
                              "Worker Number": 0,
                              "Actual Startup Time": 0.030,
                              "Actual Total Time": 0.030,
                              "Actual Rows": 16,
                              "Actual Loops": 1,
                              "Shared Hit Blocks": 1,
                              "Shared Read Blocks": 0,
                              "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": 0,
                              "Temp Written Blocks": 0
                            },
                            {
                              "Worker Number": 1,
                              "Actual Startup Time": 0.030,
                              "Actual Total Time": 0.030,
                              "Actual Rows": 16,
                              "Actual Loops": 1,
                              "Shared Hit Blocks": 1,
                              "Shared Read Blocks": 0,
                              "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": 0,
                              "Temp Written Blocks": 0
                            },
                            {
                              "Worker Number": 2,
                              "Actual Startup Time": 0.032,
                              "Actual Total Time": 0.032,
                              "Actual Rows": 16,
                              "Actual Loops": 1,
                              "Shared Hit Blocks": 1,
                              "Shared Read Blocks": 0,
                              "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": 0,
                              "Temp Written Blocks": 0
                            }
                          ],
                          "Plans": [
                            {
                              "Node Type": "Seq Scan",
                              "Parent Relationship": "Outer",
                              "Parallel Aware": false,
                              "Relation Name": "situacao_padrao",
                              "Schema": "public",
                              "Alias": "sp",
                              "Startup Cost": 0.00,
                              "Total Cost": 1.16,
                              "Plan Rows": 16,
                              "Plan Width": 16,
                              "Actual Startup Time": 0.017,
                              "Actual Total Time": 0.020,
                              "Actual Rows": 16,
                              "Actual Loops": 4,
                              "Output": ["sp.sitpadnom", "sp.sitpadcod"],
                              "Shared Hit Blocks": 4,
                              "Shared Read Blocks": 0,
                              "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": 0,
                              "Temp Written Blocks": 0,
                              "Workers": [
                                {
                                  "Worker Number": 0,
                                  "Actual Startup Time": 0.020,
                                  "Actual Total Time": 0.023,
                                  "Actual Rows": 16,
                                  "Actual Loops": 1,
                                  "Shared Hit Blocks": 1,
                                  "Shared Read Blocks": 0,
                                  "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": 0,
                                  "Temp Written Blocks": 0
                                },
                                {
                                  "Worker Number": 1,
                                  "Actual Startup Time": 0.018,
                                  "Actual Total Time": 0.020,
                                  "Actual Rows": 16,
                                  "Actual Loops": 1,
                                  "Shared Hit Blocks": 1,
                                  "Shared Read Blocks": 0,
                                  "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": 0,
                                  "Temp Written Blocks": 0
                                },
                                {
                                  "Worker Number": 2,
                                  "Actual Startup Time": 0.021,
                                  "Actual Total Time": 0.024,
                                  "Actual Rows": 16,
                                  "Actual Loops": 1,
                                  "Shared Hit Blocks": 1,
                                  "Shared Read Blocks": 0,
                                  "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": 0,
                                  "Temp Written Blocks": 0
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "Node Type": "Aggregate",
                  "Strategy": "Plain",
                  "Partial Mode": "Simple",
                  "Parent Relationship": "Inner",
                  "Parallel Aware": false,
                  "Startup Cost": 1.69,
                  "Total Cost": 1.70,
                  "Plan Rows": 1,
                  "Plan Width": 8,
                  "Actual Startup Time": 0.003,
                  "Actual Total Time": 0.003,
                  "Actual Rows": 1,
                  "Actual Loops": 194651,
                  "Output": ["count(*)"],
                  "Shared Hit Blocks": 930373,
                  "Shared Read Blocks": 0,
                  "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": 0,
                  "Temp Written Blocks": 0,
                  "Plans": [
                    {
                      "Node Type": "Index Only Scan",
                      "Parent Relationship": "Outer",
                      "Parallel Aware": false,
                      "Scan Direction": "Forward",
                      "Index Name": "contrato_iu0010",
                      "Relation Name": "contrato",
                      "Schema": "public",
                      "Alias": "x",
                      "Startup Cost": 0.56,
                      "Total Cost": 1.68,
                      "Plan Rows": 1,
                      "Plan Width": 0,
                      "Actual Startup Time": 0.002,
                      "Actual Total Time": 0.003,
                      "Actual Rows": 4,
                      "Actual Loops": 194651,
                      "Output": ["x.carcod", "x.conati", "x.devcod", "x.convalsal"],
                      "Index Cond": "((x.carcod = c.carcod) AND (x.conati = 0) AND (x.devcod = c.devcod) AND (x.convalsal > '0'::numeric))",
                      "Rows Removed by Index Recheck": 0,
                      "Heap Fetches": 131906,
                      "Shared Hit Blocks": 930373,
                      "Shared Read Blocks": 0,
                      "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": 0,
                      "Temp Written Blocks": 0
                    }
                  ]
                }
              ]
            },
            {
              "Node Type": "Limit",
              "Parent Relationship": "Inner",
              "Parallel Aware": false,
              "Startup Cost": 0.56,
              "Total Cost": 5.78,
              "Plan Rows": 1,
              "Plan Width": 4,
              "Actual Startup Time": 0.003,
              "Actual Total Time": 0.003,
              "Actual Rows": 1,
              "Actual Loops": 194651,
              "Output": ["x_1.conpardatven"],
              "Shared Hit Blocks": 974042,
              "Shared Read Blocks": 0,
              "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": 0,
              "Temp Written Blocks": 0,
              "Plans": [
                {
                  "Node Type": "Index Scan",
                  "Parent Relationship": "Outer",
                  "Parallel Aware": false,
                  "Scan Direction": "Forward",
                  "Index Name": "contrato_parcela_iu0007",
                  "Relation Name": "contrato_parcela",
                  "Schema": "public",
                  "Alias": "x_1",
                  "Startup Cost": 0.56,
                  "Total Cost": 16.22,
                  "Plan Rows": 3,
                  "Plan Width": 4,
                  "Actual Startup Time": 0.003,
                  "Actual Total Time": 0.003,
                  "Actual Rows": 1,
                  "Actual Loops": 194651,
                  "Output": ["x_1.conpardatven"],
                  "Index Cond": "((x_1.concod = c.concod) AND (x_1.conparati = 0))",
                  "Rows Removed by Index Recheck": 0,
                  "Filter": "(x_1.conparvalsal > '0'::numeric)",
                  "Rows Removed by Filter": 0,
                  "Shared Hit Blocks": 974042,
                  "Shared Read Blocks": 0,
                  "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": 0,
                  "Temp Written Blocks": 0
                }
              ]
            }
          ]
        },
        {
          "Node Type": "Limit",
          "Parent Relationship": "Inner",
          "Parallel Aware": false,
          "Startup Cost": 0.57,
          "Total Cost": 1.93,
          "Plan Rows": 1,
          "Plan Width": 12,
          "Actual Startup Time": 0.004,
          "Actual Total Time": 0.004,
          "Actual Rows": 1,
          "Actual Loops": 194651,
          "Output": ["x_2.retdataca", "x_2.retseq"],
          "Shared Hit Blocks": 974015,
          "Shared Read Blocks": 0,
          "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": 0,
          "Temp Written Blocks": 0,
          "Plans": [
            {
              "Node Type": "Index Scan",
              "Parent Relationship": "Outer",
              "Parallel Aware": false,
              "Scan Direction": "Backward",
              "Index Name": "retorno_iu0011",
              "Relation Name": "retorno",
              "Schema": "public",
              "Alias": "x_2",
              "Startup Cost": 0.57,
              "Total Cost": 16.89,
              "Plan Rows": 12,
              "Plan Width": 12,
              "Actual Startup Time": 0.004,
              "Actual Total Time": 0.004,
              "Actual Rows": 1,
              "Actual Loops": 194651,
              "Output": ["x_2.retdataca", "x_2.retseq"],
              "Index Cond": "((d.carcod = x_2.carcod) AND (d.devcod = x_2.devcod))",
              "Rows Removed by Index Recheck": 0,
              "Filter": "(x_2.usucod <> ALL ('{7,43,10,15,9,21,158,777,64,37,74,1008,3028,39,6300,1111,5,950,960,1986,1930,188,285,958,555,222,2018,2019,1987,9090,1996,1997,1992,39,1111,1117,780,1100,2000,51,17}'::integer[]))",
              "Rows Removed by Filter": 0,
              "Shared Hit Blocks": 974015,
              "Shared Read Blocks": 0,
              "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": 0,
              "Temp Written Blocks": 0
            }
          ]
        }
      ]
    },
    "Planning Time": 2.229,
    "Triggers": [
    ],
    "Execution Time": 2345.225
  }
]
@pgiraud
Copy link
Member

pgiraud commented Sep 4, 2019

There's indeed a problem. This node shouldn't be considered as a parallel one.
Thanks for the report. Are you able to provide the corresponding plan in text format?

@pgiraud
Copy link
Member

pgiraud commented Sep 4, 2019

Could you also please provide the plan both in json and text without the verbose keyword?

@lrweck
Copy link
Author

lrweck commented Sep 4, 2019

Sure, here you go.

https://pastebin.com/NuKJbwhV

@lrweck
Copy link
Author

lrweck commented Sep 4, 2019

Also, on the same plan, I see problems detecting the node type and if it's been executed or not:
image

Edit: Node types are correct, only problem is with "never executed" part.

@pgiraud
Copy link
Member

pgiraud commented Sep 11, 2019

@lrweck I just fixed the never executed issue. This should be deployed in the next minutes.
Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants