Re: BUG #18588: Cannot force/let database use parallel execution in simple case.

Maxim Boguk <maxim.boguk@gmail.com>

From: Maxim Boguk <maxim.boguk@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David Rowley <dgrowleyml@gmail.com>, pgsql-bugs@lists.postgresql.org
Date: 2024-08-22T20:27:24Z
Lists: pgsql-bugs
On Thu, Aug 22, 2024 at 10:01 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Maxim Boguk <maxim.boguk@gmail.com> writes:
> > Ok there are reproducer test case on the stock postgresql 16.4 config:
>
> Hmm, you can see both behaviors on the small version of t1, just by
> varying the comparison constant in the WHERE clause.  For me, it'll
> use only one worker with "where a<1", and not parallelize at all
> with "where a<0".  It looks like it's deciding that it's not worth
> starting workers when too few rows are expected to be returned.  That
> would be unsurprising with a normal setting of parallel_setup_cost,
> but it does seem odd with parallel_setup_cost=0.
>
> In any case, I think this isn't about the big table being big but
> about changing the range of values of "a", which changes the
> selectivity of "where a<10" 100-fold.
>
> (I tested on HEAD not v16)
>
>                         regards, tom lane
>

I especially designed both tests in a way that the expected amount of rows
- is the same in both cases.

With sufficiently large table - I didn't manage find a combinations of
settings to force parallel execution (im my real case - the database huge
and mostly cold on ssd raid - so parallel execution provides almost linear
speedup with amount of parallel workers even on 1000 rows... not talking
about 10k-10m rows, but I cannot convince the PostgreSQL use parallel index
scan for 2m returned rows case).



-- 
Maxim Boguk
Senior Postgresql DBA

Phone UA: +380 99 143 0000
Phone AU: +61  45 218 5678