Re: Unworkable plan above certain row count

2022-04-27 Thread Tom Lane
=?iso-8859-1?Q?Andr=E9_H=E4nsel?= writes: > Now if you change > INSERT INTO a(a_id) SELECT generate_series(1, 2); > to > INSERT INTO a(a_id) SELECT generate_series(1, 20); > i.e. add a zero, the plan becomes [ not a hashed subplan ] Yeah, it won't hash the subplan if the estimated size of

Unworkable plan above certain row count

2022-04-27 Thread André Hänsel
I noticed an issue in a simple query with WHERE NOT IN (SELECT ...). I am aware that anti-joins with NOT IN are currently not optimized and should be rewritten as WHERE NOT EXISTS (SELECT ...), so if this is irrelevant please just ignore it. Here is a setup that works: CREATE TABLE a ( a_

Re: Array of integer indexed nested-loop semi join

2022-04-27 Thread Mickael van der Beek
Hello Jeff, I have waited a few hours without the query ever finishing which is the reason I said "never finishes". Especially because the INNER JOIN version finishes within a few minutes while being combinatorial and less efficient. The query probably only does sequential scans. You will find th

Re: Array of integer indexed nested-loop semi join

2022-04-27 Thread Jeff Janes
On Wed, Apr 27, 2022 at 8:19 AM Mickael van der Beek < mickael.van.der.b...@gmail.com> wrote: > > The last query does not finish after waiting for more than 15 minutes. > (The temporary view creation is very fast and required due to the same > query in a CTE greatly reducing performance (by more t

Fwd: Array of integer indexed nested-loop semi join

2022-04-27 Thread Mickael van der Beek
Hello everyone, *1) Context* I'm working with large tables containing arrays of integers, indexed with " *gin__int_ops*" GIN indexes offered by the "*intarray*" extension. The goal I'm trying to achieve is to do a "nested loop semi join" using the array inclusion operation (@>) as join condition

Re: Performance differential when 0 values present vs when 1 values present. Planner return 52k rows when 0 expected.

2022-04-27 Thread David Rowley
On Wed, 27 Apr 2022 at 19:54, Emil Iggland wrote: > > > You've got the wrong column order (for this query anyway) in that > > index. It'd work a lot better if dataview were the first column; > I might be misunderstanding you, but I assume that you are suggesting an > index on (dataview, valuet

Re: Performance differential when 0 values present vs when 1 values present. Planner return 52k rows when 0 expected.

2022-04-27 Thread Emil Iggland
> You've got the wrong column order (for this query anyway) in that > index. It'd work a lot better if dataview were the first column; I might be misunderstanding you, but I assume that you are suggesting an index on (dataview, valuetimestamp). We have that index, it is the primary key. For some