Upgrade from Fedora 40 to Fedora 42, or from PostgreSQL 16.3 to PostgreSQL 16.9

Поиск
Список
Период
Сортировка
Искать

Upgrade from Fedora 40 to Fedora 42, or from PostgreSQL 16.3 to PostgreSQL 16.9

От:
"Michael J. Baars" <mjbaars1977.pgsql@gmail.com>
Дата:
Вложения:
Hello fellow PostgreSQL users and developers,

I installed a new Fedora release last week and ran into a peculiar problem:

Each night I need to run computations through about 70.000 rows and using release 16.3 that took about 4 hours to complete, but using release 16.9 the same computations now take about 8 hours to complete.

I've checked the unix sockets, inet sockets and the NVMe drive for deviations between the different kernels, but found none. Configuration files are exactly identical as well. Somewhere in between release 16.3 and release 16.9, changes must have been implemented that make the execution engine about two times slower than it was.

Two particular queries, that run about 70.000 times each night, gave the following results:

Query 1 over unix sockets:

release 16.3:
Time: 194.093 ms
Time: 169.714 ms
Time: 174.424 ms
Time: 170.285 ms

release 16.9:
Time: 281.554 ms
Time: 290.257 ms
Time: 290.886 ms
Time: 287.528 ms

Query 2 over unix sockets:

release 16.3:
Time: 132.500 ms
Time: 133.182 ms
Time: 134.511 ms
Time: 130.818 ms

release 16.9:
Time: 251.238 ms
Time: 247.749 ms
Time: 246.862 ms
Time: 248.541 ms

These differences add up to about 4 hours additional computation time each night. Apparently I have to scale down on the amount of work that can be done in one night.

Keep up the good work, but don't lose the big picture out of sight :) Hopefully this issue can be resolved quickly.

Kind regards,
Mischa.

Re: Upgrade from Fedora 40 to Fedora 42, or from PostgreSQL 16.3 to PostgreSQL 16.9

От:
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Дата:
Hi Michael,


On Fri, Jul 18, 2025 at 3:01 PM Michael J. Baars
 wrote:
>
> Hello fellow PostgreSQL users and developers,
>
> I installed a new Fedora release last week and ran into a peculiar problem:
>
> Each night I need to run computations through about 70.000 rows and using release 16.3 that took about 4 hours to complete, but using release 16.9 the same computations now take about 8 hours to complete.
>
> I've checked the unix sockets, inet sockets and the NVMe drive for deviations between the different kernels, but found none. Configuration files are exactly identical as well. Somewhere in between release 16.3 and release 16.9, changes must have been implemented that make the execution engine about two times slower than it was.
>
> Two particular queries, that run about 70.000 times each night, gave the following results:
>
> Query 1 over unix sockets:
>
> release 16.3:
> Time: 194.093 ms
> Time: 169.714 ms
> Time: 174.424 ms
> Time: 170.285 ms
>
> release 16.9:
> Time: 281.554 ms
> Time: 290.257 ms
> Time: 290.886 ms
> Time: 287.528 ms
>
> Query 2 over unix sockets:
>
> release 16.3:
> Time: 132.500 ms
> Time: 133.182 ms
> Time: 134.511 ms
> Time: 130.818 ms
>
> release 16.9:
> Time: 251.238 ms
> Time: 247.749 ms
> Time: 246.862 ms
> Time: 248.541 ms
>
> These differences add up to about 4 hours additional computation time each night. Apparently I have to scale down on the amount of work that can be done in one night.

Can you please provide "explain analyze" output of both the queries
across both releases for investigation.

-- 
Best Wishes,
Ashutosh Bapat


Re: Upgrade from Fedora 40 to Fedora 42, or from PostgreSQL 16.3 to PostgreSQL 16.9

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Michael J. Baars"  writes:
> Somewhere in between release 16.3 and
> release 16.9, changes must have been implemented that make the execution
> engine about two times slower than it was.

That seems quite unlikely, and you've surely provided no details that
would help identify any such problem.  My own first guess is that the
newer install was somehow built with debugging assertions enabled
(configure's --enable-cassert option).  Those are pretty heavyweight
and could possibly account for this.  A second guess is that you were
relying on JIT compilation and the newer install somehow omitted that
(failed to use --with-llvm).  Anyway, I'd start by comparing the
output of pg_config from both installs.

			regards, tom lane


Re: Upgrade from Fedora 40 to Fedora 42, or from PostgreSQL 16.3 to PostgreSQL 16.9

От:
"Michael J. Baars" <mjbaars1977.pgsql@gmail.com>
Дата:
On Fri, Jul 18, 2025 at 4:09 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> "Michael J. Baars" <mjbaars1977.pgsql@gmail.com> writes:
> > Somewhere in between release 16.3 and
> > release 16.9, changes must have been implemented that make the execution
> > engine about two times slower than it was.
>
> That seems quite unlikely, and you've surely provided no details that
> would help identify any such problem.  My own first guess is that the
> newer install was somehow built with debugging assertions enabled
> (configure's --enable-cassert option).  Those are pretty heavyweight
> and could possibly account for this.  A second guess is that you were
> relying on JIT compilation and the newer install somehow omitted that
> (failed to use --with-llvm).  Anyway, I'd start by comparing the
> output of pg_config from both installs.

Thanks for the tip!

These are the difference I find:

16.3 is built with

--sbindir=/usr/sbin

16.9 is built with

--sbindir=/usr/bin
-mtls-dialect=gnu2
-DOPENSSL_NO_ENGINE
-std=c17

Could these have the same effect to some degree?

Neither was built with --enable-cassert or --with-llvm.

>                         regards, tom lane

Re: Upgrade from Fedora 40 to Fedora 42, or from PostgreSQL 16.3 to PostgreSQL 16.9

От:
"Michael J. Baars" <mjbaars1977.pgsql@gmail.com>
Дата:
On Fri, Jul 18, 2025 at 4:09 PM Tom Lane  wrote:
>
> "Michael J. Baars"  writes:
> > Somewhere in between release 16.3 and
> > release 16.9, changes must have been implemented that make the execution
> > engine about two times slower than it was.
>
> That seems quite unlikely, and you've surely provided no details that
> would help identify any such problem.  My own first guess is that the
> newer install was somehow built with debugging assertions enabled
> (configure's --enable-cassert option).  Those are pretty heavyweight
> and could possibly account for this.  A second guess is that you were
> relying on JIT compilation and the newer install somehow omitted that
> (failed to use --with-llvm).  Anyway, I'd start by comparing the
> output of pg_config from both installs.
>
>                         regards, tom lane

Compiling from source with a default ./configure --prefix=/usr/local
solves the problem.

Thank you for your help!

Mischa.


Re: Upgrade from Fedora 40 to Fedora 42, or from PostgreSQL 16.3 to PostgreSQL 16.9

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Michael J. Baars"  writes:
> Compiling from source with a default ./configure --prefix=/usr/local
> solves the problem.

Cool.  I confess I have no idea what the triggering difference
was, because the extra options you mentioned before don't look
performance-relevant.  I guess -DOPENSSL_NO_ENGINE could hurt
SSL encryption speed, but unless your workload involved shoving
huge amounts of data over an SSL connection, it doesn't seem
like that would amount to much.  Anyway, probably not worth
expending additional brain cells on.

			regards, tom lane


Re: Upgrade from Fedora 40 to Fedora 42, or from PostgreSQL 16.3 to PostgreSQL 16.9

От:
"Michael J. Baars" <mjbaars1977.pgsql@gmail.com>
Дата:
On Sat, Jul 19, 2025 at 5:36 PM Tom Lane  wrote:
>
> "Michael J. Baars"  writes:
> > Compiling from source with a default ./configure --prefix=/usr/local
> > solves the problem.
>
> Cool.  I confess I have no idea what the triggering difference
> was, because the extra options you mentioned before don't look
> performance-relevant.  I guess -DOPENSSL_NO_ENGINE could hurt
> SSL encryption speed, but unless your workload involved shoving
> huge amounts of data over an SSL connection, it doesn't seem
> like that would amount to much.  Anyway, probably not worth
> expending additional brain cells on.

The funny thing is, that ssl is unset in the config files and the
default is ssl=off.

>                         regards, tom lane


Re: Upgrade from Fedora 40 to Fedora 42, or from PostgreSQL 16.3 to PostgreSQL 16.9

От:
"Michael J. Baars" <mjbaars1977.pgsql@gmail.com>
Дата:
On Sun, Jul 20, 2025 at 10:13 AM Michael J. Baars
 wrote:
>
> On Sat, Jul 19, 2025 at 5:36 PM Tom Lane  wrote:
> >
> > "Michael J. Baars"  writes:
> > > Compiling from source with a default ./configure --prefix=/usr/local
> > > solves the problem.
> >
> > Cool.  I confess I have no idea what the triggering difference
> > was, because the extra options you mentioned before don't look
> > performance-relevant.  I guess -DOPENSSL_NO_ENGINE could hurt
> > SSL encryption speed, but unless your workload involved shoving
> > huge amounts of data over an SSL connection, it doesn't seem
> > like that would amount to much.  Anyway, probably not worth
> > expending additional brain cells on.
>
> The funny thing is, that ssl is unset in the config files and the
> default is ssl=off.

That is because the problem was not SSL related :)

The problem was related to lots of errors that were written to the log
file during query execution. Errors like:

ERROR: found xmin from before relfrozenxid

The errors originated from the database migration, that was partially
done in binary mode and should have been done in text mode instead.

Execution time has actually improved over version 16.3.

Query 1 over unix sockets:

Time: 122.239 ms
Time: 123.551 ms
Time: 122.298 ms
Time: 123.282 ms

Regards,
Mischa.


FAQ