Re: Irrelevant columns cause massive performance change

2018-03-16 Thread Craig James
On Fri, Mar 16, 2018 at 1:50 PM, Andres Freund wrote: > Hi, > > On 2018-03-16 13:37:05 -0700, Craig James wrote: > > The timing of the second query is excellent, and is what I expected. I > > don't understand why including a function-defined column in the view > would > > have such a dramatic eff

Re: Irrelevant columns cause massive performance change

2018-03-16 Thread Andres Freund
Hi, On 2018-03-16 13:37:05 -0700, Craig James wrote: > The timing of the second query is excellent, and is what I expected. I > don't understand why including a function-defined column in the view would > have such a dramatic effect on the planner's ability to choose the sdf_pkey > index for the j

Irrelevant columns cause massive performance change

2018-03-16 Thread Craig James
Here's a weird one I can't figure out: the definitions of several columns of a view, which are not used in a query at all, have a massive effect on the query planner, causing it to choose a seqscan over the largest table in our database when it should be using the primary key for the join. Backgrou

Re: PG 9.6 Slow inserts with long-lasting LWLocks

2018-03-16 Thread MichaelDBA
Sporadic insert slowness could be due to lock delays (locktype=extend) due to many concurrent connections trying to insert into the same table at the same time. Each insert request may result in an extend lock (8k extension), which blocks other writers. What normally happens is the these extend