pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #16741: Error: subplan "SubPlan 1" was not initialized
4+ messages / 4 participants
[nested] [flat]

* BUG #16741: Error: subplan "SubPlan 1" was not initialized
@ 2020-11-23 22:04 PG Bug reporting form <noreply@postgresql.org>
  2020-11-23 22:39 ` Re: BUG #16741: Error: subplan "SubPlan 1" was not initialized Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: PG Bug reporting form @ 2020-11-23 22:04 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: radek@salac.org

The following bug has been logged on the website:

Bug reference:      16741
Logged by:          Radek Salač
Email address:      radek@salac.org
PostgreSQL version: 13.1
Operating system:   Debian
Description:        

When running the query (whole script can be found here: 
https://drive.google.com/file/d/1DaAZaAXVYm-Uo0mb7vxPEi6Ns5_NGd7s/view?usp=sharing)

SELECT 
1
FROM       tmp_rs_cp "cp" 
LEFT JOIN  tmp_rs_cfi  ON cp.id = tmp_rs_cfi.cp_id 
INNER JOIN tmp_rs_cpb "cpb" ON true 

ORDER BY   ( 
  SELECT 1
  FROM   tmp_rs_cpis 
  WHERE  cp.id = tmp_rs_cpis.contract_part_id 
) ASC LIMIT 10;

I'm getting error: 

ERROR: subplan "SubPlan 1" was not initialized
CONTEXT: parallel worker

In PG 13.0 it failed without meaningfull error so we updated but it's still
not working


The explain plan in my case is (JSON format):


[
  {
    "Plan": {
      "Node Type": "Limit",
      "Parallel Aware": false,
      "Startup Cost": 2100.44,
      "Total Cost": 2431.82,
      "Plan Rows": 10,
      "Plan Width": 8,
      "Output": ["1", "((SubPlan 1))"],
      "Plans": [
        {
          "Node Type": "Nested Loop",
          "Parent Relationship": "Outer",
          "Parallel Aware": false,
          "Join Type": "Inner",
          "Startup Cost": 2100.44,
          "Total Cost": 1690024934.78,
          "Plan Rows": 51000000,
          "Plan Width": 8,
          "Output": ["1", "(SubPlan 1)"],
          "Inner Unique": false,
          "Plans": [
            {
              "Node Type": "Nested Loop",
              "Parent Relationship": "Outer",
              "Parallel Aware": false,
              "Join Type": "Left",
              "Startup Cost": 2100.44,
              "Total Cost": 12392.90,
              "Plan Rows": 20000,
              "Plan Width": 16,
              "Output": ["cp.id"],
              "Inner Unique": false,
              "Plans": [
                {
                  "Node Type": "Gather Merge",
                  "Parent Relationship": "Outer",
                  "Parallel Aware": false,
                  "Startup Cost": 2100.29,
                  "Total Cost": 4379.70,
                  "Plan Rows": 20000,
                  "Plan Width": 16,
                  "Output": ["cp.id"],
                  "Workers Planned": 1,
                  "Plans": [
                    {
                      "Node Type": "Sort",
                      "Parent Relationship": "Outer",
                      "Parallel Aware": false,
                      "Startup Cost": 1100.28,
                      "Total Cost": 1129.69,
                      "Plan Rows": 11765,
                      "Plan Width": 16,
                      "Output": ["cp.id", "((SubPlan 1))"],
                      "Sort Key": ["((SubPlan 1))"],
                      "Plans": [
                        {
                          "Node Type": "Index Only Scan",
                          "Parent Relationship": "Outer",
                          "Parallel Aware": true,
                          "Scan Direction": "Forward",
                          "Index Name": "tmp_rs_cp_id_idx",
                          "Relation Name": "tmp_rs_cp",
                          "Schema": "public",
                          "Alias": "cp",
                          "Startup Cost": 0.29,
                          "Total Cost": 304.83,
                          "Plan Rows": 11765,
                          "Plan Width": 16,
                          "Output": ["cp.id", "(SubPlan 1)"],
                          "Plans": [
                            {
                              "Node Type": "Seq Scan",
                              "Parent Relationship": "SubPlan",
                              "Subplan Name": "SubPlan 1",
                              "Parallel Aware": false,
                              "Relation Name": "tmp_rs_cpis",
                              "Schema": "public",
                              "Alias": "tmp_rs_cpis",
                              "Startup Cost": 0.00,
                              "Total Cost": 33.12,
                              "Plan Rows": 9,
                              "Plan Width": 4,
                              "Output": ["1"],
                              "Filter": "(cp.id =
tmp_rs_cpis.contract_part_id)"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "Node Type": "Index Only Scan",
                  "Parent Relationship": "Inner",
                  "Parallel Aware": false,
                  "Scan Direction": "Forward",
                  "Index Name": "tmp_rs_cfi_cp_id_idx",
                  "Relation Name": "tmp_rs_cfi",
                  "Schema": "public",
                  "Alias": "tmp_rs_cfi",
                  "Startup Cost": 0.15,
                  "Total Cost": 0.31,
                  "Plan Rows": 9,
                  "Plan Width": 16,
                  "Output": ["tmp_rs_cfi.cp_id"],
                  "Index Cond": "(tmp_rs_cfi.cp_id = cp.id)"
                }
              ]
            },
            {
              "Node Type": "Materialize",
              "Parent Relationship": "Inner",
              "Parallel Aware": false,
              "Startup Cost": 0.00,
              "Total Cost": 48.25,
              "Plan Rows": 2550,
              "Plan Width": 0,
              "Plans": [
                {
                  "Node Type": "Seq Scan",
                  "Parent Relationship": "Outer",
                  "Parallel Aware": false,
                  "Relation Name": "tmp_rs_cpb",
                  "Schema": "public",
                  "Alias": "cpb",
                  "Startup Cost": 0.00,
                  "Total Cost": 35.50,
                  "Plan Rows": 2550,
                  "Plan Width": 0
                }
              ]
            }
          ]
        }
      ]
    }
  }
]



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #16741: Error: subplan "SubPlan 1" was not initialized
  2020-11-23 22:04 BUG #16741: Error: subplan "SubPlan 1" was not initialized PG Bug reporting form <noreply@postgresql.org>
@ 2020-11-23 22:39 ` Tom Lane <tgl@sss.pgh.pa.us>
  2020-11-29 13:21   ` Re: BUG #16741: Error: subplan "SubPlan 1" was not initialized James Coleman <jtc331@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2020-11-23 22:39 UTC (permalink / raw)
  To: radek@salac.org; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> I'm getting error: 

> ERROR: subplan "SubPlan 1" was not initialized
> CONTEXT: parallel worker

Yeah, this is a known issue that we haven't yet fixed, cf [1].

I believe you should be able to work around it for now
by turning off enable_incremental_sort.

			regards, tom lane

[1] https://www.postgresql.org/message-id/flat/622580997.37108180.1604080457319.JavaMail.zimbra%40siscob...





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #16741: Error: subplan "SubPlan 1" was not initialized
  2020-11-23 22:04 BUG #16741: Error: subplan "SubPlan 1" was not initialized PG Bug reporting form <noreply@postgresql.org>
  2020-11-23 22:39 ` Re: BUG #16741: Error: subplan "SubPlan 1" was not initialized Tom Lane <tgl@sss.pgh.pa.us>
@ 2020-11-29 13:21   ` James Coleman <jtc331@gmail.com>
  2020-11-29 22:28     ` Re: BUG #16741: Error: subplan "SubPlan 1" was not initialized Radek Salač <radek@salac.org>
  0 siblings, 1 reply; 4+ messages in thread

From: James Coleman @ 2020-11-29 13:21 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: radek@salac.org, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

On Mon, Nov 23, 2020 at 5:39 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> PG Bug reporting form <noreply@postgresql.org> writes:
> > I'm getting error:
>
> > ERROR: subplan "SubPlan 1" was not initialized
> > CONTEXT: parallel worker
>
> Yeah, this is a known issue that we haven't yet fixed, cf [1].
>
> I believe you should be able to work around it for now
> by turning off enable_incremental_sort.
>
>                         regards, tom lane
>
> [1] https://www.postgresql.org/message-id/flat/622580997.37108180.1604080457319.JavaMail.zimbra%40siscob...


That might workaround it for 13/13.1, though the attached plan has a
sort, not an incremental sort, and so it's possible that won't help
(disabling parallel query for this particular query would then
resolve, but that's a fairly large sledgehammer).

A fix is being discussed in [1].

James

1: https://www.postgresql.org/message-id/flat/CAAaqYe8cK3g5CfLC4w7bs%3DhC0mSksZC%3DH5M8LSchj5e5OxpTAg%4...





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #16741: Error: subplan "SubPlan 1" was not initialized
  2020-11-23 22:04 BUG #16741: Error: subplan "SubPlan 1" was not initialized PG Bug reporting form <noreply@postgresql.org>
  2020-11-23 22:39 ` Re: BUG #16741: Error: subplan "SubPlan 1" was not initialized Tom Lane <tgl@sss.pgh.pa.us>
  2020-11-29 13:21   ` Re: BUG #16741: Error: subplan "SubPlan 1" was not initialized James Coleman <jtc331@gmail.com>
@ 2020-11-29 22:28     ` Radek Salač <radek@salac.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Radek Salač @ 2020-11-29 22:28 UTC (permalink / raw)
  To: James Coleman <jtc331@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

Hi

I tried to disable "incremental sort", but it doesn't help.
Completely disabling parallel query worked for me, but you are right it's
quite a big change.
So we postpone the upgrade of Postgre in production for now.
I wish you luck with fixing that issue and I really appreciate your work /
help.

Thanks



On Sun, Nov 29, 2020 at 2:22 PM James Coleman <jtc331@gmail.com> wrote:

> On Mon, Nov 23, 2020 at 5:39 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >
> > PG Bug reporting form <noreply@postgresql.org> writes:
> > > I'm getting error:
> >
> > > ERROR: subplan "SubPlan 1" was not initialized
> > > CONTEXT: parallel worker
> >
> > Yeah, this is a known issue that we haven't yet fixed, cf [1].
> >
> > I believe you should be able to work around it for now
> > by turning off enable_incremental_sort.
> >
> >                         regards, tom lane
> >
> > [1]
> https://www.postgresql.org/message-id/flat/622580997.37108180.1604080457319.JavaMail.zimbra%40siscob...
>
>
> That might workaround it for 13/13.1, though the attached plan has a
> sort, not an incremental sort, and so it's possible that won't help
> (disabling parallel query for this particular query would then
> resolve, but that's a fairly large sledgehammer).
>
> A fix is being discussed in [1].
>
> James
>
> 1:
> https://www.postgresql.org/message-id/flat/CAAaqYe8cK3g5CfLC4w7bs%3DhC0mSksZC%3DH5M8LSchj5e5OxpTAg%4...
>

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2020-11-29 22:28 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-23 22:04 BUG #16741: Error: subplan "SubPlan 1" was not initialized PG Bug reporting form <noreply@postgresql.org>
2020-11-23 22:39 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-11-29 13:21   ` James Coleman <jtc331@gmail.com>
2020-11-29 22:28     ` Radek Salač <radek@salac.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox