Re: Simple DELETE on modest-size table runs 100% CPU forever

2019-11-16 Thread Craig James
Problem solved ... see below. Thanks everyone for your suggestions and insights! On Sat, Nov 16, 2019 at 7:16 AM Jeff Janes wrote: > On Fri, Nov 15, 2019 at 7:27 PM Craig James wrote: > >> On Fri, Nov 15, 2019 at 2:45 PM Jeff Janes wrote: >> BTW, I'll note at this point that "analyze category_

Re: Simple DELETE on modest-size table runs 100% CPU forever

2019-11-16 Thread Jeff Janes
On Fri, Nov 15, 2019 at 7:27 PM Craig James wrote: > On Fri, Nov 15, 2019 at 2:45 PM Jeff Janes wrote: > BTW, I'll note at this point that "analyze category_staging_8" prior to > this query made no difference. > Isn't that the wrong table to have analyzed? The offender here is "categories", not

Re: Simple DELETE on modest-size table runs 100% CPU forever

2019-11-15 Thread Craig James
On Fri, Nov 15, 2019 at 2:45 PM Jeff Janes wrote: > On Thu, Nov 14, 2019 at 5:20 PM Craig James wrote: > >> I'm completely baffled by this problem: I'm doing a delete that joins >> three modest-sized tables, and it gets completely stuck: 100% CPU use >> forever. Here's the query: >> >> >> Aggre

Re: Simple DELETE on modest-size table runs 100% CPU forever

2019-11-15 Thread Jeff Janes
On Thu, Nov 14, 2019 at 5:20 PM Craig James wrote: > I'm completely baffled by this problem: I'm doing a delete that joins > three modest-sized tables, and it gets completely stuck: 100% CPU use > forever. Here's the query: > > > Aggregate (cost=193.54..193.55 rows=1 width=8) > -> Nested Loo

RE: Simple DELETE on modest-size table runs 100% CPU forever

2019-11-15 Thread Ravi Rai
@lists.postgresql.org Subject: Re: Simple DELETE on modest-size table runs 100% CPU forever On Thu, Nov 14, 2019 at 2:29 PM Andres Freund mailto:and...@anarazel.de>> wrote: Hi, On 2019-11-14 14:19:51 -0800, Craig James wrote: > I'm completely baffled by this problem: I'm doing a dele

Re: Simple DELETE on modest-size table runs 100% CPU forever

2019-11-15 Thread Craig James
On Thu, Nov 14, 2019 at 2:29 PM Andres Freund wrote: > Hi, > > On 2019-11-14 14:19:51 -0800, Craig James wrote: > > I'm completely baffled by this problem: I'm doing a delete that joins > three > > modest-sized tables, and it gets completely stuck: 100% CPU use forever. > > Here's the query: > >

Re: Simple DELETE on modest-size table runs 100% CPU forever

2019-11-14 Thread Andres Freund
Hi, On 2019-11-14 14:19:51 -0800, Craig James wrote: > I'm completely baffled by this problem: I'm doing a delete that joins three > modest-sized tables, and it gets completely stuck: 100% CPU use forever. > Here's the query: I assume this is intended to be an equivalent SELECT? Because you did m

Re: Simple DELETE on modest-size table runs 100% CPU forever

2019-11-14 Thread Justin Pryzby
On Thu, Nov 14, 2019 at 02:19:51PM -0800, Craig James wrote: > I'm completely baffled by this problem: I'm doing a delete that joins three > modest-sized tables, and it gets completely stuck: 100% CPU use forever. > Here's the query: > > explain analyze > select count(1) from registry.categories

Re: Simple DELETE on modest-size table runs 100% CPU forever

2019-11-14 Thread Michael Lewis
> If I leave out the "analyze", here's what I get (note that the > categories_staging_N table's name changes every time; it's > created on demand as "create table categories_staging_n(id integer)"). > How/when are they created? In the same statement? After create, are you analyzing these tables? I

Re: Simple DELETE on modest-size table runs 100% CPU forever

2019-11-14 Thread Alvaro Herrera
On 2019-Nov-14, Craig James wrote: > I'm completely baffled by this problem: I'm doing a delete that joins three > modest-sized tables, and it gets completely stuck: 100% CPU use forever. Do you have any FKs there? If any delete is cascading, and you don't have an index on the other side, it'd d

Simple DELETE on modest-size table runs 100% CPU forever

2019-11-14 Thread Craig James
I'm completely baffled by this problem: I'm doing a delete that joins three modest-sized tables, and it gets completely stuck: 100% CPU use forever. Here's the query: explain analyze select count(1) from registry.categories where category_id = 15 and id in (select c.id from registry.categor