Slow timestamp query after upgrading from Pg13 to Pg16

From: Simon Windsor <simon(dot)windsor(at)cornfield(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Slow timestamp query after upgrading from Pg13 to Pg16
Date: 2025-04-07 14:48:48
Message-ID: 27b2975b-c078-45cf-815d-eddbedbda153@cornfield.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

After upgrading a Db from Pg13 (Centos) to Pg16(Ubuntu) some queries on
a simple, large table (200M rows) are very slow

id integer not null
status char(4) not null
status_tstamp timestamp
<... other columns ...>

If I create indexes on

* status, status_tstamp
* status_tstamp when status_timestamp is not null

Queries for a set date range for a given status are good and perform
similarly to Pg13

Queries for a set date range are VERY slow compared to Pg13. A few other
queries on tables with indexes like

CREATE INDEX table_col ON table (col) WHERE col IS NOT NULL;

also appear to be slow.

Any ideas, observations or comments would be appreciated

Simon

--
Simon Windsor

Eml:simon(dot)windsor(at)cornfield(dot)me(dot)uk
Mob: 0755 197 9733

“There is nothing in the world that some man cannot make a little worse and sell a little cheaper, and he who considers price only is that man's lawful prey.”

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2025-04-07 14:51:40 Re: Slow timestamp query after upgrading from Pg13 to Pg16
Previous Message Tom Lane 2025-04-07 14:06:48 Re: Custom index access method for primary keys