Re: Query got Killed with CTE.

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Query got Killed with CTE.
Date: 2017-10-17 15:29:09
Message-ID: CAMsr+YFen_0w0eU6CL8fQFFaDWVwq2yVAZ_L=drgwvL+Pi+sLw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 17 October 2017 at 21:18, Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>
wrote:

> Hi,
>
> While quering with CTE against PG HEAD , i found that query got killed
> with this below error logs
> -- Machine Configuration: (d1.xlarge) CUPs : 8 , RAM : 16GB , SIze : 640GB
>
> postgres=# with x as (select 5 c1 from generate_series(1,1000000) x)
> select * from x x1 join x x2 using(c1);
> Killed
> 2017-10-17 14:12:33.558 BST [949] LOG: could not send data to client:
> Broken pipe
> 2017-10-17 14:12:33.558 BST [949] STATEMENT: with x as (select 5 c1 from
> generate_series(1,1000000) x) select * from x x1 join x x2 using(c1);
> 2017-10-17 14:12:33.559 BST [949] FATAL: connection to client lost
> 2017-10-17 14:12:33.559 BST [949] STATEMENT: with x as (select 5 c1 from
> generate_series(1,1000000) x) select * from x x1 join x x2 using(c1);
>
>
You produced a huge cross-product by the looks, and psql ran of of RAM
buffering the result. The OOM killer fired (check 'dmesg' to confirm) and
killed psql. The server noticed psql going away, and reported the fact.

None of this is surprising. What's the problem here?

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2017-10-17 16:06:08 Re: PATCH: enabling parallel execution for cursors explicitly (experimental)
Previous Message Craig Ringer 2017-10-17 15:27:14 Re: SIGSEGV in BRIN autosummarize