Re: Problems with estimating OR conditions, IS NULL on LEFT JOINs - Mailing list pgsql-hackers

From Andrey Lepikhov
Subject Re: Problems with estimating OR conditions, IS NULL on LEFT JOINs
Date
Msg-id 6ed3a29e-b4b9-e4b6-e8a1-b1d7d00bbd88@postgrespro.ru
Whole thread Raw
In response to Re: Problems with estimating OR conditions, IS NULL on LEFT JOINs  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Responses Re: Problems with estimating OR conditions, IS NULL on LEFT JOINs
List pgsql-hackers
On 24/6/2023 17:23, Tomas Vondra wrote:
> I really hope what I just wrote makes at least a little bit of sense.
Throw in one more example:

SELECT i AS id INTO l FROM generate_series(1,100000) i;
CREATE TABLE r (id int8, v text);
INSERT INTO r (id, v) VALUES (1, 't'), (-1, 'f');
ANALYZE l,r;
EXPLAIN ANALYZE
SELECT * FROM l LEFT OUTER JOIN r ON (r.id = l.id) WHERE r.v IS NULL;

Here you can see the same kind of underestimation:
Hash Left Join  (... rows=500 width=14) (... rows=99999 ...)

So the eqjoinsel_unmatch_left() function should be modified for the case 
where nd1<nd2.

-- 
regards,
Andrey Lepikhov
Postgres Professional




pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: 'converts internal representation to "..."' comment is confusing
Next
From: Peter Eisentraut
Date:
Subject: Clean up command argument assembly