Re: [PERFORM] Very poor performance with Nested Loop Anti Join

2016-08-02 Thread Andreas Joseph Krogh
På tirsdag 02. august 2016 kl. 01:15:05, skrev Tom Lane mailto:t...@sss.pgh.pa.us>>: Andreas Joseph Krogh writes: > This query performs terribly slow (~26 minutes,��1561346.597ms): Seems like the key misestimation is on the inner antijoin: >                ->  Hash Anti Join  (cost=654.21..40

Re: [PERFORM] Very poor performance with Nested Loop Anti Join

2016-08-01 Thread Tom Lane
Andreas Joseph Krogh writes: > This query performs terribly slow (~26 minutes, 1561346.597ms): Seems like the key misestimation is on the inner antijoin: >-> Hash Anti Join (cost=654.21..4008.72 rows=1 width=8) > (actual time=9.016..40.672 rows=76174 loops=1) >

Re: [PERFORM] Very poor performance with Nested Loop Anti Join

2016-08-01 Thread Andreas Joseph Krogh
På mandag 01. august 2016 kl. 15:33:04, skrev Andreas Joseph Krogh < andr...@visena.com >: I have this schema:   CREATE TABLE onp_crm_person( id serial PRIMARY KEY, onp_user_id bigint referencesonp_user(id) deferrable initially deferred, is_resource boolean not null def

[PERFORM] Very poor performance with Nested Loop Anti Join

2016-08-01 Thread Andreas Joseph Krogh
I have this schema:   CREATE TABLE onp_crm_person( id serial PRIMARY KEY, onp_user_id bigint referencesonp_user(id) deferrable initially deferred, is_resource boolean not null default false, UNIQUE(onp_user_id) ); CREATE TABLE onp_crm_activity_log( id bigserial PRIMARY KEY, relation_id integer RE