public inbox for [email protected]
help / color / mirror / Atom feedRe: Slow timestamp query after upgrading from Pg13 to Pg16
4+ messages / 3 participants
[nested] [flat]
* Re: Slow timestamp query after upgrading from Pg13 to Pg16
@ 2025-04-07 14:51 Laurenz Albe <[email protected]>
0 siblings, 1 reply; 4+ messages in thread
From: Laurenz Albe @ 2025-04-07 14:51 UTC (permalink / raw)
To: Simon Windsor <[email protected]>; pgsql-general
On Mon, 2025-04-07 at 15:48 +0100, Simon Windsor wrote:
> After upgrading a Db from Pg13 (Centos) to Pg16(Ubuntu) some queries
> on a simple, large table (200M rows) are very slow
If you used "pg_upgrade", did you ANALYZE the database?
If that is not the problem, we can't guess what your problem might be
unless you provide EXPLAIN (ANALYZE, BUFFERS, SETTINGS) output for auch a
slow query. Ideally, add the same information for the fast v13 case.
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Slow timestamp query after upgrading from Pg13 to Pg16
@ 2025-04-07 19:25 Simon Windsor <[email protected]>
parent: Laurenz Albe <[email protected]>
0 siblings, 2 replies; 4+ messages in thread
From: Simon Windsor @ 2025-04-07 19:25 UTC (permalink / raw)
To: Laurenz Albe <[email protected]>; pgsql-general
Hi
We used pg_dump|pg_restore to migrate the data.
The full explain plan is at https://explain.depesz.com/s/742M. The SQL
explain (analyze, buffers) select count(*) from consignments where
(req_status_tstamp >= '2025-03-28 00:00'::timestamp and
req_status_tstamp <= '2025-03-28 01:00'::timestamp);
takes 2-3s with the old Pg13 DB, and over a minute with Pg16
After spending many hours looking at DB settings and Statistic settings
I am at a loss/
Simon
On 07/04/2025 15:51, Laurenz Albe wrote:
> On Mon, 2025-04-07 at 15:48 +0100, Simon Windsor wrote:
>> After upgrading a Db from Pg13 (Centos) to Pg16(Ubuntu) some queries
>> on a simple, large table (200M rows) are very slow
> If you used "pg_upgrade", did you ANALYZE the database?
>
> If that is not the problem, we can't guess what your problem might be
> unless you provide EXPLAIN (ANALYZE, BUFFERS, SETTINGS) output for auch a
> slow query. Ideally, add the same information for the fast v13 case.
>
> Yours,
> Laurenz Albe
--
Simon Windsor
Eml: [email protected]
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.”
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Slow timestamp query after upgrading from Pg13 to Pg16
@ 2025-04-07 19:36 Adrian Klaver <[email protected]>
parent: Simon Windsor <[email protected]>
1 sibling, 0 replies; 4+ messages in thread
From: Adrian Klaver @ 2025-04-07 19:36 UTC (permalink / raw)
To: Simon Windsor <[email protected]>; Laurenz Albe <[email protected]>; pgsql-general
On 4/7/25 12:25, Simon Windsor wrote:
> Hi
>
> We used pg_dump|pg_restore to migrate the data.
Did you do an ANALYZE on the Postgres 16 instance after the pg_restore?
>
> The full explain plan is at https://explain.depesz.com/s/742M. The SQL
>
> explain (analyze, buffers) select count(*) from consignments where
> (req_status_tstamp >= '2025-03-28 00:00'::timestamp and
> req_status_tstamp <= '2025-03-28 01:00'::timestamp);
>
> takes 2-3s with the old Pg13 DB, and over a minute with Pg16
Do you have an EXPLAIN ANALYZE for the Postgres 13 case?
>
> After spending many hours looking at DB settings and Statistic settings
> I am at a loss/
>
> Simon
>
--
Adrian Klaver
[email protected]
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Slow timestamp query after upgrading from Pg13 to Pg16
@ 2025-04-08 06:40 Laurenz Albe <[email protected]>
parent: Simon Windsor <[email protected]>
1 sibling, 0 replies; 4+ messages in thread
From: Laurenz Albe @ 2025-04-08 06:40 UTC (permalink / raw)
To: Simon Windsor <[email protected]>; pgsql-general
On Mon, 2025-04-07 at 20:25 +0100, Simon Windsor wrote:
> We used pg_dump|pg_restore to migrate the data.
>
> The full explain plan is at https://explain.depesz.com/s/742M. The SQL
>
> explain (analyze, buffers) select count(*) from consignments where
> (req_status_tstamp >= '2025-03-28 00:00'::timestamp and
> req_status_tstamp <= '2025-03-28 01:00'::timestamp);
>
> takes 2-3s with the old Pg13 DB, and over a minute with Pg16
>
> After spending many hours looking at DB settings and Statistic settings
> I am at a loss/
Thanks.
- Can you show the index definitions on that table?
- If you "SET enable_seqscan = off;" in an interactive session, PostgreSQL
should choose an index scan if possible. Can you show the
EXPLAIN (ANALYZE, BUFFERS) output for that execution?
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2025-04-08 06:40 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-04-07 14:51 Re: Slow timestamp query after upgrading from Pg13 to Pg16 Laurenz Albe <[email protected]>
2025-04-07 19:25 ` Simon Windsor <[email protected]>
2025-04-07 19:36 ` Adrian Klaver <[email protected]>
2025-04-08 06:40 ` Laurenz Albe <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox