Re: Naive question about multithreading/multicore

2024-10-14 Thread Marc SCHAEFER
Hello,

On Sun, Oct 13, 2024 at 08:16:04AM +1300, Thomas Munro wrote:
> > template1=> SELECT COUNT(*) FROM pg_class a, pg_class b, pg_class c;
> >
> > I see only one 100% CPU PostgreSQL process.
> 
> If you set set min_parallel_table_scan_size = 0 then it uses

Without it, it uses one CPU and takes about 8.5 s (count is 57512456).

With it, it is indeed parallel (multiple CPU used) and it takes about 6s.

As this is on a machine with slow disks, it is perfectly ok, I just
wanted to see the CPU parallelism in action.

Thank you!




Naive question about multithreading/multicore

2024-10-12 Thread Marc SCHAEFER
Hello,

on a machine where starting two processes:
   perl -e 'while (1) { ; }'
I see two processed at 100% CPU, which is expected (with top).

Now, if I do:

template1=> SELECT COUNT(*) FROM pg_class a, pg_class b, pg_class c;

I see only one 100% CPU PostgreSQL process.

I read that while PostgreSQL connetions lead to a UNIX process model,
which is better for isolation, some operations have been parallelized
and can use more than one core/thread.

Maybe this specific case was not (yet?) parallelized, or should it
be and thus something is issing in my configuration?

Thank you.

PS: psql (13.16 (Debian 13.16-0+deb11u1))